Add empty feature for Usage (global admin)

This commit is contained in:
Richard Downer 2011-12-16 15:17:05 +00:00
parent a221e5131e
commit f5c9ba6c0a
6 changed files with 153 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import org.jclouds.cloudstack.features.GlobalCapacityAsyncClient;
import org.jclouds.cloudstack.features.GlobalHostAsyncClient;
import org.jclouds.cloudstack.features.GlobalOfferingAsyncClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolAsyncClient;
import org.jclouds.cloudstack.features.GlobalUsageAsyncClient;
import org.jclouds.cloudstack.features.GlobalUserAsyncClient;
import org.jclouds.rest.annotations.Delegate;
@ -84,4 +85,9 @@ public interface CloudStackGlobalAsyncClient extends CloudStackDomainAsyncClient
@Delegate
GlobalStoragePoolAsyncClient getStoragePoolClient();
/**
* Provides asynchronous access to Usage
*/
@Delegate
GlobalUsageAsyncClient getUsageClient();
}

View File

@ -26,6 +26,7 @@ import org.jclouds.cloudstack.features.GlobalCapacityClient;
import org.jclouds.cloudstack.features.GlobalHostClient;
import org.jclouds.cloudstack.features.GlobalOfferingClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolClient;
import org.jclouds.cloudstack.features.GlobalUsageClient;
import org.jclouds.cloudstack.features.GlobalUserClient;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
@ -88,4 +89,9 @@ public interface CloudStackGlobalClient extends CloudStackDomainClient {
@Delegate
GlobalStoragePoolClient getStoragePoolClient();
/**
* Provides synchronous access to Usage
*/
@Delegate
GlobalUsageClient getUsageClient();
}

View File

@ -60,6 +60,8 @@ import org.jclouds.cloudstack.features.GlobalOfferingAsyncClient;
import org.jclouds.cloudstack.features.GlobalOfferingClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolAsyncClient;
import org.jclouds.cloudstack.features.GlobalStoragePoolClient;
import org.jclouds.cloudstack.features.GlobalUsageAsyncClient;
import org.jclouds.cloudstack.features.GlobalUsageClient;
import org.jclouds.cloudstack.features.GlobalUserAsyncClient;
import org.jclouds.cloudstack.features.GlobalUserClient;
import org.jclouds.cloudstack.features.GuestOSAsyncClient;
@ -155,6 +157,7 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
.put(GlobalOfferingClient.class, GlobalOfferingAsyncClient.class)//
.put(GlobalHostClient.class, GlobalHostAsyncClient.class)//
.put(GlobalStoragePoolClient.class, GlobalStoragePoolAsyncClient.class)//
.put(GlobalUsageClient.class, GlobalUsageAsyncClient.class)//
.build();
@Override

View File

@ -0,0 +1,49 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import com.google.common.util.concurrent.ListenableFuture;
import org.jclouds.cloudstack.binders.BindEndDateAsYyyyMmDdToQueryParams;
import org.jclouds.cloudstack.binders.BindStartDateAsYyyyMmDdToQueryParams;
import org.jclouds.cloudstack.domain.JobResult;
import org.jclouds.cloudstack.filters.QuerySigner;
import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.core.MediaType;
import java.util.Date;
/**
* Provides asynchronous access to CloudStack usage features.
* <p/>
*
* @see GlobalOfferingAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" />
* @author Richard Downer
*/
@RequestFilters(QuerySigner.class)
@QueryParams(keys = "response", values = "json")
public interface GlobalUsageAsyncClient {
}

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 org.jclouds.cloudstack.domain.JobResult;
import org.jclouds.cloudstack.domain.UsageRecord;
import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
import org.jclouds.concurrent.Timeout;
import java.util.Date;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* Provides synchronous access to CloudStack usage features.
* <p/>
*
* @see org.jclouds.cloudstack.features.GlobalOfferingAsyncClient
* @see <a href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" />
* @author Richard Downer
*/
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface GlobalUsageClient {
}

View File

@ -0,0 +1,47 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.cloudstack.features;
import com.google.inject.TypeLiteral;
import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/**
* Tests behavior of {@code GlobalUsageAsyncClient}
*
* @author Richard Downer
*/
@Test(groups = "unit", testName = "GlobalUsageAsyncClientTest")
public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalUsageAsyncClient> {
@Override
protected TypeLiteral<RestAnnotationProcessor<GlobalUsageAsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<GlobalUsageAsyncClient>>() {
};
}
}