mirror of https://github.com/apache/jclouds.git
Removed @Nullable annotations on region parameters
This commit is contained in:
parent
aa04ef007f
commit
4030a4c4f0
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rackspace.cloudfiles.v1;
|
package org.jclouds.rackspace.cloudfiles.v1;
|
||||||
|
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
|
||||||
import org.jclouds.openstack.swift.v1.SwiftApi;
|
import org.jclouds.openstack.swift.v1.SwiftApi;
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.features.CDNApi;
|
import org.jclouds.rackspace.cloudfiles.v1.features.CDNApi;
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.functions.RegionToCDNEndpoint;
|
import org.jclouds.rackspace.cloudfiles.v1.functions.RegionToCDNEndpoint;
|
||||||
|
@ -47,7 +46,7 @@ public interface CloudFilesApi extends SwiftApi {
|
||||||
* @return the {@link CDNApi} for the specified region.
|
* @return the {@link CDNApi} for the specified region.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
CDNApi getCDNApi(@EndpointParam(parser = RegionToCDNEndpoint.class) @Nullable String region);
|
CDNApi getCDNApi(@EndpointParam(parser = RegionToCDNEndpoint.class) String region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to Cloud Files CDN features.
|
* Provides access to Cloud Files CDN features.
|
||||||
|
@ -60,5 +59,5 @@ public interface CloudFilesApi extends SwiftApi {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Delegate
|
@Delegate
|
||||||
CDNApi cdnApiInRegion(@EndpointParam(parser = RegionToCDNEndpoint.class) @Nullable String region);
|
CDNApi cdnApiInRegion(@EndpointParam(parser = RegionToCDNEndpoint.class) String region);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi;
|
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.binders.BindCDNPurgeEmailAddressesToHeaders;
|
import org.jclouds.rackspace.cloudfiles.v1.binders.BindCDNPurgeEmailAddressesToHeaders;
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.domain.CDNContainer;
|
import org.jclouds.rackspace.cloudfiles.v1.domain.CDNContainer;
|
||||||
import org.jclouds.rackspace.cloudfiles.v1.functions.ParseCDNContainerFromHeaders;
|
import org.jclouds.rackspace.cloudfiles.v1.functions.ParseCDNContainerFromHeaders;
|
||||||
|
@ -60,12 +59,12 @@ import com.google.common.collect.FluentIterable;
|
||||||
* Provides access to the Rackspace Cloud Files CDN API features.
|
* Provides access to the Rackspace Cloud Files CDN API features.
|
||||||
*
|
*
|
||||||
* <h3>NOTE</h3>
|
* <h3>NOTE</h3>
|
||||||
* Before a container can be CDN enabled, it must exist in the storage system.
|
* Before a container can be CDN enabled, it must exist in the storage system.
|
||||||
* To CDN enable the container, perform PUT request against it using the <code>publicURL</code>
|
* To CDN enable the container, perform PUT request against it using the <code>publicURL</code>
|
||||||
* noted in the service catalog for Cloud Files during Authentication and set the
|
* noted in the service catalog for Cloud Files during Authentication and set the
|
||||||
* <code>X-CDN-Enabled</code> header to <code>true</code>.
|
* <code>X-CDN-Enabled</code> header to <code>true</code>.
|
||||||
*
|
*
|
||||||
* @see {@link CloudFilesApi#getCDNApiForRegion(String)}
|
* @see {@link org.jclouds.rackspace.cloudfiles.v1.CloudFilesApi#getCDNApi(String)}
|
||||||
*/
|
*/
|
||||||
@Beta
|
@Beta
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
@RequestFilters(AuthenticateRequest.class)
|
||||||
|
@ -74,7 +73,7 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists up to 10,000 CDN containers.
|
* Lists up to 10,000 CDN containers.
|
||||||
*
|
*
|
||||||
* @return a list of CDN enabled containers ordered by name.
|
* @return a list of CDN enabled containers ordered by name.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:list")
|
@Named("cdn:list")
|
||||||
|
@ -86,10 +85,10 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists CDN containers, with the given options.
|
* Lists CDN containers, with the given options.
|
||||||
*
|
*
|
||||||
* @param options
|
* @param options
|
||||||
* the options to control output.
|
* the options to control output.
|
||||||
*
|
*
|
||||||
* @return a list of CDN enabled containers ordered by name.
|
* @return a list of CDN enabled containers ordered by name.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:list")
|
@Named("cdn:list")
|
||||||
|
@ -101,10 +100,10 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the specified CDN Container.
|
* Gets the specified CDN Container.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* the name of the CDN Container
|
* the name of the CDN Container
|
||||||
*
|
*
|
||||||
* @return the CDNContainer or null, if not found.
|
* @return the CDNContainer or null, if not found.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:get")
|
@Named("cdn:get")
|
||||||
|
@ -117,10 +116,10 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the {@link CDNContainer}.
|
* Enables the {@link CDNContainer}.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* corresponds to {@link CDNContainer#getName()}.
|
* corresponds to {@link CDNContainer#getName()}.
|
||||||
*
|
*
|
||||||
* @return the CDN container {@link URI} or {@code null}, if not found.
|
* @return the CDN container {@link URI} or {@code null}, if not found.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:enable")
|
@Named("cdn:enable")
|
||||||
|
@ -134,12 +133,12 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the {@link CDNContainer} with a TTL.
|
* Enables the {@link CDNContainer} with a TTL.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* corresponds to {@link CDNContainer#getName()}.
|
* corresponds to {@link CDNContainer#getName()}.
|
||||||
* @param ttl
|
* @param ttl
|
||||||
* the TTL for the CDN Container.
|
* the TTL for the CDN Container.
|
||||||
*
|
*
|
||||||
* @return the CDN container {@link URI} or {@code null}, if not found.
|
* @return the CDN container {@link URI} or {@code null}, if not found.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:enable")
|
@Named("cdn:enable")
|
||||||
|
@ -149,15 +148,15 @@ public interface CDNApi extends Closeable {
|
||||||
@Path("/{containerName}")
|
@Path("/{containerName}")
|
||||||
@Headers(keys = CDN_ENABLED, values = "true")
|
@Headers(keys = CDN_ENABLED, values = "true")
|
||||||
@Nullable
|
@Nullable
|
||||||
URI enable(@PathParam("containerName") String containerName,
|
URI enable(@PathParam("containerName") String containerName,
|
||||||
@HeaderParam(CDN_TTL) int ttl);
|
@HeaderParam(CDN_TTL) int ttl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the {@link CDNContainer}.
|
* Disables the {@link CDNContainer}.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* corresponds to {@link CDNContainer#getName()}.
|
* corresponds to {@link CDNContainer#getName()}.
|
||||||
*
|
*
|
||||||
* @return {@code true} if the container was disabled, {@code false} if not.
|
* @return {@code true} if the container was disabled, {@code false} if not.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:disable")
|
@Named("cdn:disable")
|
||||||
|
@ -169,14 +168,14 @@ public interface CDNApi extends Closeable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purges an object from the CDN.
|
* Purges an object from the CDN.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* corresponds to {@link CDNContainer#getName()}.
|
* corresponds to {@link CDNContainer#getName()}.
|
||||||
* @param objectName
|
* @param objectName
|
||||||
* the object in the {@link CDNContainer} to purge.
|
* the object in the {@link CDNContainer} to purge.
|
||||||
* @param emails
|
* @param emails
|
||||||
* the email addresses to notify after purging.
|
* the email addresses to notify after purging.
|
||||||
*
|
*
|
||||||
* @return {@code true} if the object was successfully purged, {@code false} if not.
|
* @return {@code true} if the object was successfully purged, {@code false} if not.
|
||||||
*/
|
*/
|
||||||
@Named("cdn:purge")
|
@Named("cdn:purge")
|
||||||
|
@ -184,16 +183,16 @@ public interface CDNApi extends Closeable {
|
||||||
@Fallback(FalseOnNotFoundOr404.class)
|
@Fallback(FalseOnNotFoundOr404.class)
|
||||||
@Path("/{containerName}/{objectName}")
|
@Path("/{containerName}/{objectName}")
|
||||||
@Headers(keys = CloudFilesHeaders.CDN_PURGE_OBJECT_EMAIL, values = "{email}")
|
@Headers(keys = CloudFilesHeaders.CDN_PURGE_OBJECT_EMAIL, values = "{email}")
|
||||||
boolean purgeObject(@PathParam("containerName") String containerName,
|
boolean purgeObject(@PathParam("containerName") String containerName,
|
||||||
@PathParam("objectName") String objectName,
|
@PathParam("objectName") String objectName,
|
||||||
@BinderParam(BindCDNPurgeEmailAddressesToHeaders.class) Iterable<String> emails);
|
@BinderParam(BindCDNPurgeEmailAddressesToHeaders.class) Iterable<String> emails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a CDN container with the supplied {@link UpdateCDNContainerOptions} options.
|
* Updates a CDN container with the supplied {@link UpdateCDNContainerOptions} options.
|
||||||
*
|
*
|
||||||
* @param containerName
|
* @param containerName
|
||||||
* corresponds to {@link CDNContainer#getName()}.
|
* corresponds to {@link CDNContainer#getName()}.
|
||||||
*
|
*
|
||||||
* @param options
|
* @param options
|
||||||
* the {@link UpdateCDNContainerOptions} options.
|
* the {@link UpdateCDNContainerOptions} options.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class ParseCDNContainerFromHeaders implements Function<HttpResponse, CDNC
|
||||||
String enabled = checkNotNull(from.getFirstHeaderOrNull(CDN_ENABLED), CDN_ENABLED);
|
String enabled = checkNotNull(from.getFirstHeaderOrNull(CDN_ENABLED), CDN_ENABLED);
|
||||||
String logRetention = checkNotNull(from.getFirstHeaderOrNull(CDN_LOG_RETENTION), CDN_LOG_RETENTION);
|
String logRetention = checkNotNull(from.getFirstHeaderOrNull(CDN_LOG_RETENTION), CDN_LOG_RETENTION);
|
||||||
String ttl = checkNotNull(from.getFirstHeaderOrNull(CDN_TTL), CDN_TTL);
|
String ttl = checkNotNull(from.getFirstHeaderOrNull(CDN_TTL), CDN_TTL);
|
||||||
|
|
||||||
// just need the name from the path
|
// just need the name from the path
|
||||||
List<String> parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath()));
|
List<String> parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath()));
|
||||||
checkArgument(parts.size() > 0);
|
checkArgument(!parts.isEmpty());
|
||||||
|
|
||||||
return CDNContainer.builder().name(parts.get(parts.size() - 1))
|
return CDNContainer.builder().name(parts.get(parts.size() - 1))
|
||||||
.enabled(Boolean.parseBoolean(enabled))
|
.enabled(Boolean.parseBoolean(enabled))
|
||||||
.logRetention(Boolean.parseBoolean(logRetention))
|
.logRetention(Boolean.parseBoolean(logRetention))
|
||||||
|
|
|
@ -34,15 +34,15 @@ import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class ensures that the correct Cloud Files CDN endpoint is retrieved from the endpoint
|
* This class ensures that the correct Cloud Files CDN endpoint is retrieved from the endpoint
|
||||||
* supplier. The CDN API should never be instantiated directly, but rather accessed through the
|
* supplier. The CDN API should never be instantiated directly, but rather accessed through the
|
||||||
* {@link CloudFilesApi#cdnApiInRegion(String)} API.
|
* {@link CloudFilesApi#cdnApiInRegion(String)} API.
|
||||||
* <p/>
|
* <p/>
|
||||||
* <h3>NOTE</h3>
|
* <h3>NOTE</h3>
|
||||||
* The Cloud Files Service Type will always default to OpenStack Object Storage ("object-storage").
|
* The Cloud Files Service Type will always default to OpenStack Object Storage ("object-storage").
|
||||||
* <p/>
|
* <p/>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @see CloudFilesApi#cdnApiInRegion(String)
|
* @see CloudFilesApi#cdnApiInRegion(String)
|
||||||
* @see CDNApi
|
* @see CDNApi
|
||||||
* @see RegionToEndpoint
|
* @see RegionToEndpoint
|
||||||
|
@ -53,7 +53,7 @@ import com.google.common.base.Supplier;
|
||||||
* Service Access Endpoints</a>
|
* Service Access Endpoints</a>
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class RegionToCDNEndpoint implements Function<Object, URI> {
|
public class RegionToCDNEndpoint implements Function<Object, URI> {
|
||||||
|
|
||||||
private final Supplier<Map<String, Supplier<URI>>> endpointsSupplier;
|
private final Supplier<Map<String, Supplier<URI>>> endpointsSupplier;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class RegionToCDNEndpoint implements Function<Object, URI> {
|
||||||
public URI apply(@Nullable Object from) {
|
public URI apply(@Nullable Object from) {
|
||||||
checkArgument(from != null && from instanceof String, "you must specify a region, as a String argument");
|
checkArgument(from != null && from instanceof String, "you must specify a region, as a String argument");
|
||||||
Map<String, Supplier<URI>> regionToEndpoint = endpointsSupplier.get();
|
Map<String, Supplier<URI>> regionToEndpoint = endpointsSupplier.get();
|
||||||
checkState(regionToEndpoint.size() > 0, "no region name to endpoint mappings configured!");
|
checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint mappings configured!");
|
||||||
checkArgument(regionToEndpoint.containsKey(from),
|
checkArgument(regionToEndpoint.containsKey(from),
|
||||||
"requested location %s, which is not in the configured locations: %s", from, regionToEndpoint);
|
"requested location %s, which is not in the configured locations: %s", from, regionToEndpoint);
|
||||||
return regionToEndpoint.get(from).get();
|
return regionToEndpoint.get(from).get();
|
||||||
|
|
Loading…
Reference in New Issue