Merge pull request #124 from vijaykiran/master

Events#listEventTypes
This commit is contained in:
Adrian Cole 2011-11-10 00:47:23 -08:00
commit 48f2c9c5ec
43 changed files with 368 additions and 37 deletions

View File

@ -22,6 +22,7 @@ import org.jclouds.cloudstack.features.AccountAsyncClient;
import org.jclouds.cloudstack.features.AddressAsyncClient; import org.jclouds.cloudstack.features.AddressAsyncClient;
import org.jclouds.cloudstack.features.AsyncJobAsyncClient; import org.jclouds.cloudstack.features.AsyncJobAsyncClient;
import org.jclouds.cloudstack.features.ConfigurationAsyncClient; import org.jclouds.cloudstack.features.ConfigurationAsyncClient;
import org.jclouds.cloudstack.features.EventAsyncClient;
import org.jclouds.cloudstack.features.FirewallAsyncClient; import org.jclouds.cloudstack.features.FirewallAsyncClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient; import org.jclouds.cloudstack.features.GuestOSAsyncClient;
import org.jclouds.cloudstack.features.HypervisorAsyncClient; import org.jclouds.cloudstack.features.HypervisorAsyncClient;
@ -32,8 +33,8 @@ import org.jclouds.cloudstack.features.OfferingAsyncClient;
import org.jclouds.cloudstack.features.SSHKeyPairAsyncClient; import org.jclouds.cloudstack.features.SSHKeyPairAsyncClient;
import org.jclouds.cloudstack.features.SecurityGroupAsyncClient; import org.jclouds.cloudstack.features.SecurityGroupAsyncClient;
import org.jclouds.cloudstack.features.TemplateAsyncClient; import org.jclouds.cloudstack.features.TemplateAsyncClient;
import org.jclouds.cloudstack.features.VirtualMachineAsyncClient;
import org.jclouds.cloudstack.features.VMGroupAsyncClient; import org.jclouds.cloudstack.features.VMGroupAsyncClient;
import org.jclouds.cloudstack.features.VirtualMachineAsyncClient;
import org.jclouds.cloudstack.features.ZoneAsyncClient; import org.jclouds.cloudstack.features.ZoneAsyncClient;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
@ -43,7 +44,7 @@ import org.jclouds.rest.annotations.Delegate;
* *
* @author Adrian Cole * @author Adrian Cole
* @see CloudStackClient * @see CloudStackClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
*/ */
public interface CloudStackAsyncClient { public interface CloudStackAsyncClient {
@ -150,4 +151,10 @@ public interface CloudStackAsyncClient {
@Delegate @Delegate
VMGroupAsyncClient getVMGroupClient(); VMGroupAsyncClient getVMGroupClient();
/**
* Provides synchronous access to Events
*/
@Delegate
EventAsyncClient getEventClient();
} }

View File

@ -24,6 +24,7 @@ import org.jclouds.cloudstack.features.AccountClient;
import org.jclouds.cloudstack.features.AddressClient; import org.jclouds.cloudstack.features.AddressClient;
import org.jclouds.cloudstack.features.AsyncJobClient; import org.jclouds.cloudstack.features.AsyncJobClient;
import org.jclouds.cloudstack.features.ConfigurationClient; import org.jclouds.cloudstack.features.ConfigurationClient;
import org.jclouds.cloudstack.features.EventClient;
import org.jclouds.cloudstack.features.FirewallClient; import org.jclouds.cloudstack.features.FirewallClient;
import org.jclouds.cloudstack.features.GuestOSClient; import org.jclouds.cloudstack.features.GuestOSClient;
import org.jclouds.cloudstack.features.HypervisorClient; import org.jclouds.cloudstack.features.HypervisorClient;
@ -45,7 +46,7 @@ import org.jclouds.rest.annotations.Delegate;
* <p/> * <p/>
* *
* @see CloudStackAsyncClient * @see CloudStackAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
@ -153,4 +154,10 @@ public interface CloudStackClient {
@Delegate @Delegate
VMGroupClient getVMGroupClient(); VMGroupClient getVMGroupClient();
/**
* Provides synchronous access to Events
*/
@Delegate
EventClient getEventClient();
} }

View File

@ -30,6 +30,8 @@ import org.jclouds.cloudstack.features.AsyncJobAsyncClient;
import org.jclouds.cloudstack.features.AsyncJobClient; import org.jclouds.cloudstack.features.AsyncJobClient;
import org.jclouds.cloudstack.features.ConfigurationAsyncClient; import org.jclouds.cloudstack.features.ConfigurationAsyncClient;
import org.jclouds.cloudstack.features.ConfigurationClient; import org.jclouds.cloudstack.features.ConfigurationClient;
import org.jclouds.cloudstack.features.EventAsyncClient;
import org.jclouds.cloudstack.features.EventClient;
import org.jclouds.cloudstack.features.FirewallAsyncClient; import org.jclouds.cloudstack.features.FirewallAsyncClient;
import org.jclouds.cloudstack.features.FirewallClient; import org.jclouds.cloudstack.features.FirewallClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient; import org.jclouds.cloudstack.features.GuestOSAsyncClient;
@ -94,6 +96,7 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
.put(HypervisorClient.class, HypervisorAsyncClient.class)// .put(HypervisorClient.class, HypervisorAsyncClient.class)//
.put(ConfigurationClient.class, ConfigurationAsyncClient.class)// .put(ConfigurationClient.class, ConfigurationAsyncClient.class)//
.put(AccountClient.class, AccountAsyncClient.class)// .put(AccountClient.class, AccountAsyncClient.class)//
.put(EventClient.class, EventAsyncClient.class)//
.put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)// .put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)//
.put(VMGroupClient.class, VMGroupAsyncClient.class)// .put(VMGroupClient.class, VMGroupAsyncClient.class)//
.build(); .build();

View File

@ -43,7 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see AccountClient * @see AccountClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -29,7 +29,7 @@ import org.jclouds.concurrent.Timeout;
* Provides synchronous access to CloudStack Account features. * Provides synchronous access to CloudStack Account features.
* <p/> * <p/>
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see AddressClient * @see AddressClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -32,7 +32,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see IPAddressAsyncClient * @see IPAddressAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see AsyncJobClient * @see AsyncJobClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -30,7 +30,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see AsyncJobAsyncClient * @see AsyncJobAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -35,7 +35,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see ConfigurationClient * @see ConfigurationClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -28,7 +28,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see ConfigurationAsyncClient * @see ConfigurationAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -0,0 +1,56 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import java.util.Set;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
/**
* Provides asynchronous access to cloudstack via their REST API.
* <p/>
*
* @author Vijay Kiran
* @see org.jclouds.cloudstack.features.AccountClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
*/
@RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json")
public interface EventAsyncClient {
/**
* @see EventClient#listEventTypes()
*/
@GET
@QueryParams(keys = "command", values = "listEventTypes")
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseEventTypesFromHttpResponse.class)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<String>> listEventTypes();
}

View File

@ -0,0 +1,42 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
/**
* Provides synchronous access to CloudStack Event features.
* <p/>
*
* @author Vijay Kiran
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
*/
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface EventClient {
/**
* List Event Types
*
* @return event types or null if not found
*/
Set<String> listEventTypes();
}

View File

@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see FirewallClient * @see FirewallClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -31,7 +31,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see PortForwardingRuleAsyncClient * @see PortForwardingRuleAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see AsyncJobClient * @see AsyncJobClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -31,7 +31,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see GuestOSAsyncClient * @see GuestOSAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -38,7 +38,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see AsyncJobClient * @see AsyncJobClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -28,7 +28,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see GuestOSAsyncClient * @see GuestOSAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see LoadBalancerClient * @see LoadBalancerClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -32,7 +32,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see LoadBalancerAsyncClient * @see LoadBalancerAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see NATClient * @see NATClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -32,7 +32,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see IPForwardingRuleAsyncClient * @see IPForwardingRuleAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see NetworkClient * @see NetworkClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -31,7 +31,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see NetworkAsyncClient * @see NetworkAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see OfferingClient * @see OfferingClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -34,7 +34,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see OfferingAsyncClient * @see OfferingAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see OfferingClient * @see OfferingClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -33,7 +33,7 @@ import com.google.common.collect.Multimap;
* <p/> * <p/>
* *
* @see SecurityGroupAsyncClient * @see SecurityGroupAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -43,7 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see TemplateClient * @see TemplateClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -31,7 +31,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see TemplateAsyncClient * @see TemplateAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -41,7 +41,7 @@ import java.util.Set;
* *
* @author Richard Downer * @author Richard Downer
* @see VMGroupClient * @see VMGroupClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json") @QueryParams(keys = "response", values = "json")

View File

@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
* *
* @author Richard Downer * @author Richard Downer
* @see VMGroupAsyncClient * @see VMGroupAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface VMGroupClient { public interface VMGroupClient {

View File

@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see VirtualMachineClient * @see VirtualMachineClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -32,7 +32,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see VirtualMachineAsyncClient * @see VirtualMachineAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -43,7 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* <p/> * <p/>
* *
* @see ZoneClient * @see ZoneClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@RequestFilters(QuerySigner.class) @RequestFilters(QuerySigner.class)

View File

@ -30,7 +30,7 @@ import org.jclouds.concurrent.Timeout;
* <p/> * <p/>
* *
* @see ZoneAsyncClient * @see ZoneAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)

View File

@ -0,0 +1,72 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.inject.Singleton;
import java.util.Set;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.inject.Inject;
import com.google.inject.TypeLiteral;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.json.internal.GsonWrapper;
/**
* @author Vijay Kiran
*/
@Singleton
public class ParseEventTypesFromHttpResponse implements Function<HttpResponse, Set<String>> {
private final ParseFirstJsonValueNamed<Set<EventType>> parser;
private static class EventType {
private String name;
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
}
@Inject
public ParseEventTypesFromHttpResponse(GsonWrapper gsonWrapper) {
this.parser = new ParseFirstJsonValueNamed<Set<EventType>>(checkNotNull(gsonWrapper, "gsonWrapper"),
new TypeLiteral<Set<EventType>>() {
}, "eventtype");
}
public Set<String> apply(HttpResponse response) {
checkNotNull(response, "response");
Set<EventType> toParse = parser.apply(response);
checkNotNull(toParse, "parsed result from %s", response);
Builder<String> builder = ImmutableSet.<String>builder();
for (EventType entry : toParse)
builder.add(entry.name);
return builder.build();
}
}

View File

@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableSet;
/** /**
* Options for services that apply to accounts in domains * Options for services that apply to accounts in domains
* *
* @see <a href="http://download.cloud.com/releases/2.2.0/api/TOC_User.html" /> * @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" />
* @author Adrian Cole * @author Adrian Cole
*/ */
public class AccountInDomainOptions extends BaseHttpRequestOptions { public class AccountInDomainOptions extends BaseHttpRequestOptions {

View File

@ -0,0 +1,31 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.options;
/**
* Options used to control what events are returned
*
* @author Vijay Kiran
* @see <a href=
* "http://download.cloud.com/releases/2.2.0/api_2.2.12/user/listEvents.html"
* />
*/
public class ListEventsOptions {
}

View File

@ -0,0 +1,64 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import java.io.IOException;
import java.lang.reflect.Method;
import com.google.inject.TypeLiteral;
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
import org.jclouds.http.HttpRequest;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
/**
* Tests behavior of {@code EventAsyncClient}
*
* @author Vijay Kiran
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "EventAsyncClientTest")
public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsyncClient> {
public void testListEventTypes() throws SecurityException, NoSuchMethodException, IOException {
Method method = EventAsyncClient.class.getMethod("listEventTypes");
HttpRequest httpRequest = processor.createRequest(method);
assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=listEventTypes HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseEventTypesFromHttpResponse.class);
assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@Override
protected TypeLiteral<RestAnnotationProcessor<EventAsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<EventAsyncClient>>() {
};
}
}

View File

@ -0,0 +1,48 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import static org.testng.Assert.assertTrue;
import java.util.Set;
import org.testng.annotations.Test;
/**
* Tests behavior of {@code EventClient}
*
* @author Vijay Kiran
*/
@Test(groups = "live", singleThreaded = true, testName = "EventClientLiveTest")
public class EventClientLiveTest extends BaseCloudStackClientLiveTest {
public void testlistEventTypes() throws Exception {
Set<String> response = client.getEventClient().listEventTypes();
assert null != response;
assertTrue(response.size() >= 0);
for (String type : response) {
checkEventType(type);
}
}
protected void checkEventType(String eventType) {
assert eventType != null : eventType;
}
}

View File

@ -0,0 +1 @@
{ "listeventtypesresponse" : { "count":123 ,"eventtype" : [ {"name":"VM.CREATE"}, {"name":"VM.DESTROY"}, {"name":"VM.START"}, {"name":"VM.STOP"}, {"name":"VM.REBOOT"}, {"name":"VM.UPDATE"}, {"name":"VM.UPGRADE"}, {"name":"VM.RESETPASSWORD"}, {"name":"VM.MIGRATE"}, {"name":"ROUTER.CREATE"}, {"name":"ROUTER.DESTROY"}, {"name":"ROUTER.START"}, {"name":"ROUTER.STOP"}, {"name":"ROUTER.REBOOT"}, {"name":"ROUTER.HA"}, {"name":"ROUTER.UPGRADE"}, {"name":"PROXY.CREATE"}, {"name":"PROXY.DESTROY"}, {"name":"PROXY.START"}, {"name":"PROXY.STOP"}, {"name":"PROXY.REBOOT"}, {"name":"PROXY.HA"}, {"name":"VNC.CONNECT"}, {"name":"VNC.DISCONNECT"}, {"name":"NET.IPASSIGN"}, {"name":"NET.IPRELEASE"}, {"name":"NET.RULEADD"}, {"name":"NET.RULEDELETE"}, {"name":"NET.RULEMODIFY"}, {"name":"NETWORK.CREATE"}, {"name":"NETWORK.DELETE"}, {"name":"NETWORK.UPDATE"}, {"name":"LB.ASSIGN.TO.RULE"}, {"name":"LB.REMOVE.FROM.RULE"}, {"name":"LB.CREATE"}, {"name":"LB.DELETE"}, {"name":"LB.UPDATE"}, {"name":"ACCOUNT.DISABLE"}, {"name":"ACCOUNT.CREATE"}, {"name":"ACCOUNT.DELETE"}, {"name":"USER.LOGIN"}, {"name":"USER.LOGOUT"}, {"name":"USER.CREATE"}, {"name":"USER.DELETE"}, {"name":"USER.DISABLE"}, {"name":"USER.UPDATE"}, {"name":"USER.ENABLE"}, {"name":"TEMPLATE.CREATE"}, {"name":"TEMPLATE.DELETE"}, {"name":"TEMPLATE.UPDATE"}, {"name":"TEMPLATE.DOWNLOAD.START"}, {"name":"TEMPLATE.DOWNLOAD.SUCCESS"}, {"name":"TEMPLATE.DOWNLOAD.FAILED"}, {"name":"TEMPLATE.COPY"}, {"name":"TEMPLATE.EXTRACT"}, {"name":"TEMPLATE.UPLOAD"}, {"name":"TEMPLATE.CLEANUP"}, {"name":"VOLUME.CREATE"}, {"name":"VOLUME.DELETE"}, {"name":"VOLUME.ATTACH"}, {"name":"VOLUME.DETACH"}, {"name":"VOLUME.EXTRACT"}, {"name":"VOLUME.UPLOAD"}, {"name":"DOMAIN.CREATE"}, {"name":"DOMAIN.DELETE"}, {"name":"DOMAIN.UPDATE"}, {"name":"SNAPSHOT.CREATE"}, {"name":"SNAPSHOT.DELETE"}, {"name":"SNAPSHOTPOLICY.CREATE"}, {"name":"SNAPSHOTPOLICY.UPDATE"}, {"name":"SNAPSHOTPOLICY.DELETE"}, {"name":"ISO.CREATE"}, {"name":"ISO.DELETE"}, {"name":"ISO.COPY"}, {"name":"ISO.ATTACH"}, {"name":"ISO.DETACH"}, {"name":"ISO.EXTRACT"}, {"name":"ISO.UPLOAD"}, {"name":"SSVM.CREATE"}, {"name":"SSVM.DESTROY"}, {"name":"SSVM.START"}, {"name":"SSVM.STOP"}, {"name":"SSVM.REBOOT"}, {"name":"SSVM.HA"}, {"name":"SERVICE.OFFERING.CREATE"}, {"name":"SERVICE.OFFERING.EDIT"}, {"name":"SERVICE.OFFERING.DELETE"}, {"name":"DISK.OFFERING.CREATE"}, {"name":"DISK.OFFERING.EDIT"}, {"name":"DISK.OFFERING.DELETE"}, {"name":"NETWORK.OFFERING.CREATE"}, {"name":"NETWORK.OFFERING.ASSIGN"}, {"name":"NETWORK.OFFERING.EDIT"}, {"name":"NETWORK.OFFERING.REMOVE"}, {"name":"NETWORK.OFFERING.DELETE"}, {"name":"POD.CREATE"}, {"name":"POD.EDIT"}, {"name":"POD.DELETE"}, {"name":"ZONE.CREATE"}, {"name":"ZONE.EDIT"}, {"name":"ZONE.DELETE"}, {"name":"VLAN.IP.RANGE.CREATE"}, {"name":"VLAN.IP.RANGE.DELETE"}, {"name":"CONFIGURATION.VALUE.EDIT"}, {"name":"SG.AUTH.INGRESS"}, {"name":"SG.REVOKE.INGRESS"}, {"name":"SG.CREATE"}, {"name":"SG.DELETE"}, {"name":"HOST.RECONNECT"}, {"name":"MAINT.CANCEL"}, {"name":"MAINT.CANCEL.PS"}, {"name":"MAINT.PREPARE"}, {"name":"MAINT.PREPARE.PS"}, {"name":"VPN.REMOTE.ACCESS.CREATE"}, {"name":"VPN.REMOTE.ACCESS.DESTROY"}, {"name":"VPN.USER.ADD"}, {"name":"VPN.USER.REMOVE"}, {"name":"NETWORK.RESTART"}, {"name":"UPLOAD.CUSTOM.CERTIFICATE"}, {"name":"STATICNAT.ENABLE"}, {"name":"STATICNAT.DISABLE"}, {"name":"ZONE.VLAN.ASSIGN"}, {"name":"ZONE.VLAN.RELEASE"} ] } }