mirror of https://github.com/apache/jclouds.git
network client + wiring
This commit is contained in:
parent
60e39a4a99
commit
f2732fc49e
|
@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5;
|
||||||
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
@ -41,8 +42,14 @@ public interface VCloudDirectorAsyncClient {
|
||||||
Session getCurrentSession();
|
Session getCurrentSession();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return synchronous access to Org features
|
* @return asynchronous access to Org features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
OrgAsyncClient getOrgClient();
|
OrgAsyncClient getOrgClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return asynchronous access to Network features
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
NetworkAsyncClient getNetworkClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
@ -48,4 +49,10 @@ public interface VCloudDirectorClient {
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
OrgClient getOrgClient();
|
OrgClient getOrgClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return synchronous access to Network features
|
||||||
|
*/
|
||||||
|
@Delegate
|
||||||
|
NetworkClient getNetworkClient();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.annotations.Login;
|
import org.jclouds.vcloud.director.v1_5.annotations.Login;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
import org.jclouds.vcloud.director.v1_5.domain.Session;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
||||||
|
@ -72,6 +74,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
||||||
.put(OrgClient.class, OrgAsyncClient.class)
|
.put(OrgClient.class, OrgAsyncClient.class)
|
||||||
|
.put(NetworkClient.class, NetworkAsyncClient.class)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public VCloudDirectorRestClientModule() {
|
public VCloudDirectorRestClientModule() {
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
* 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.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
import org.jclouds.rest.annotations.ExceptionParser;
|
||||||
|
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* @see NetworkClient
|
||||||
|
* @author danikov
|
||||||
|
*/
|
||||||
|
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||||
|
public interface NetworkAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NeworkClient#getNetwork()
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam URI uri);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NeworkClient#getMetadata()
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/metadata/")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<Metadata> getMetadata(@EndpointParam URI orgRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see NeworkClient#getMetadataEntry()
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
|
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam URI metaDataRef);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.jclouds.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.jclouds.concurrent.Timeout;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to Network.
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see NetworkAsyncClient
|
||||||
|
* @see <a href= "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID=" />
|
||||||
|
* @author danikov
|
||||||
|
*/
|
||||||
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
|
public interface NetworkClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a network.
|
||||||
|
*
|
||||||
|
* @return the network or null if not found
|
||||||
|
*/
|
||||||
|
OrgNetwork getNetwork(URI networkRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves an list of the network's metadata
|
||||||
|
*
|
||||||
|
* @return a list of metadata
|
||||||
|
*/
|
||||||
|
Metadata getMetadata(URI networkRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a metadata entry
|
||||||
|
*
|
||||||
|
* @return the metadata entry, or null if not found
|
||||||
|
*/
|
||||||
|
MetadataEntry getMetadataEntry(URI metaDataRef);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue