mirror of https://github.com/apache/jclouds.git
Use the regular API endpoint for registerUserKeys
This commit is contained in:
parent
64a1593c0c
commit
9f14503cf6
|
@ -38,7 +38,6 @@ public class CloudStackPropertiesBuilder extends PropertiesBuilder {
|
||||||
properties.setProperty(PROPERTY_API_VERSION, "2.2");
|
properties.setProperty(PROPERTY_API_VERSION, "2.2");
|
||||||
properties.setProperty("jclouds.ssh.max-retries", "7");
|
properties.setProperty("jclouds.ssh.max-retries", "7");
|
||||||
properties.setProperty("jclouds.ssh.retry-auth", "true");
|
properties.setProperty("jclouds.ssh.retry-auth", "true");
|
||||||
properties.setProperty("jclouds.cloudstack.integration-api-port", "8096");
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/**
|
|
||||||
* 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.collections;
|
|
||||||
|
|
||||||
import javax.inject.Qualifier;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the endpoint as needed for the integration API
|
|
||||||
*
|
|
||||||
* @author Andrei Savu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
|
||||||
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
|
||||||
@Qualifier
|
|
||||||
public @interface Integration {
|
|
||||||
|
|
||||||
}
|
|
|
@ -18,16 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.cloudstack.config;
|
package org.jclouds.cloudstack.config;
|
||||||
|
|
||||||
import static com.google.common.base.Throwables.propagate;
|
import com.google.common.base.Function;
|
||||||
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
import java.net.URI;
|
import com.google.common.cache.CacheLoader;
|
||||||
import java.util.Map;
|
import com.google.common.cache.LoadingCache;
|
||||||
import java.util.concurrent.ExecutionException;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Provides;
|
||||||
import javax.ws.rs.core.UriBuilder;
|
import com.google.inject.Singleton;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
import com.google.inject.name.Named;
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.cloudstack.CloudStackAsyncClient;
|
import org.jclouds.cloudstack.CloudStackAsyncClient;
|
||||||
import org.jclouds.cloudstack.CloudStackClient;
|
import org.jclouds.cloudstack.CloudStackClient;
|
||||||
|
@ -35,7 +36,6 @@ import org.jclouds.cloudstack.CloudStackDomainAsyncClient;
|
||||||
import org.jclouds.cloudstack.CloudStackDomainClient;
|
import org.jclouds.cloudstack.CloudStackDomainClient;
|
||||||
import org.jclouds.cloudstack.CloudStackGlobalAsyncClient;
|
import org.jclouds.cloudstack.CloudStackGlobalAsyncClient;
|
||||||
import org.jclouds.cloudstack.CloudStackGlobalClient;
|
import org.jclouds.cloudstack.CloudStackGlobalClient;
|
||||||
import org.jclouds.cloudstack.collections.Integration;
|
|
||||||
import org.jclouds.cloudstack.domain.LoginResponse;
|
import org.jclouds.cloudstack.domain.LoginResponse;
|
||||||
import org.jclouds.cloudstack.features.AccountAsyncClient;
|
import org.jclouds.cloudstack.features.AccountAsyncClient;
|
||||||
import org.jclouds.cloudstack.features.AccountClient;
|
import org.jclouds.cloudstack.features.AccountClient;
|
||||||
|
@ -139,18 +139,12 @@ import org.jclouds.rest.config.BinderUtils;
|
||||||
import org.jclouds.rest.config.RestClientModule;
|
import org.jclouds.rest.config.RestClientModule;
|
||||||
import org.jclouds.rest.internal.RestContextImpl;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import java.util.Map;
|
||||||
import com.google.common.base.Supplier;
|
import java.util.concurrent.ExecutionException;
|
||||||
import com.google.common.base.Suppliers;
|
import java.util.concurrent.TimeUnit;
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
import com.google.common.cache.CacheLoader;
|
import static com.google.common.base.Throwables.propagate;
|
||||||
import com.google.common.cache.LoadingCache;
|
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
import com.google.inject.Singleton;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
import com.google.inject.name.Named;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the cloudstack connection.
|
* Configures the cloudstack connection.
|
||||||
|
@ -254,26 +248,6 @@ public class CloudStackRestClientModule extends RestClientModule<CloudStackClien
|
||||||
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudStackErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(CloudStackErrorHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
@Provides
|
|
||||||
@Integration
|
|
||||||
protected Supplier<URI> providesIntegrationEndpoint(@Provider final Supplier<URI> provider,
|
|
||||||
@Named("jclouds.cloudstack.integration-api-port") final int port,
|
|
||||||
final com.google.inject.Provider<UriBuilder> uriBuilder) {
|
|
||||||
return Suppliers.compose(new Function<URI, URI>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public URI apply(URI input) {
|
|
||||||
URI normal = provider.get();
|
|
||||||
return uriBuilder.get().scheme(normal.getScheme()).host(normal.getHost()).path("/").port(port).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(){
|
|
||||||
return "getIntegrationEndpoint()";
|
|
||||||
}
|
|
||||||
}, provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
static class CredentialTypeFromPropertyOrDefault implements javax.inject.Provider<CredentialType> {
|
static class CredentialTypeFromPropertyOrDefault implements javax.inject.Provider<CredentialType> {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,13 +19,11 @@
|
||||||
package org.jclouds.cloudstack.features;
|
package org.jclouds.cloudstack.features;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import org.jclouds.cloudstack.collections.Integration;
|
|
||||||
import org.jclouds.cloudstack.domain.ApiKeyPair;
|
import org.jclouds.cloudstack.domain.ApiKeyPair;
|
||||||
import org.jclouds.cloudstack.domain.User;
|
import org.jclouds.cloudstack.domain.User;
|
||||||
import org.jclouds.cloudstack.filters.AuthenticationFilter;
|
import org.jclouds.cloudstack.filters.AuthenticationFilter;
|
||||||
import org.jclouds.cloudstack.options.CreateUserOptions;
|
import org.jclouds.cloudstack.options.CreateUserOptions;
|
||||||
import org.jclouds.cloudstack.options.UpdateUserOptions;
|
import org.jclouds.cloudstack.options.UpdateUserOptions;
|
||||||
import org.jclouds.rest.annotations.Endpoint;
|
|
||||||
import org.jclouds.rest.annotations.ExceptionParser;
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
import org.jclouds.rest.annotations.QueryParams;
|
import org.jclouds.rest.annotations.QueryParams;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
@ -68,7 +66,6 @@ public interface GlobalUserAsyncClient extends DomainUserAsyncClient {
|
||||||
@GET
|
@GET
|
||||||
@QueryParams(keys = "command", values = "registerUserKeys")
|
@QueryParams(keys = "command", values = "registerUserKeys")
|
||||||
@SelectJson("userkeys")
|
@SelectJson("userkeys")
|
||||||
@Endpoint(Integration.class)
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<ApiKeyPair> registerUserKeys(@QueryParam("id") long userId);
|
ListenableFuture<ApiKeyPair> registerUserKeys(@QueryParam("id") long userId);
|
||||||
|
|
Loading…
Reference in New Issue