mirror of https://github.com/apache/jclouds.git
Remove redundant binder implementations in GCE.
This commit is contained in:
parent
d6fbd8cc7b
commit
fff7ad0f11
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.BucketAccessControlsTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class BucketAccessControlsBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
BucketAccessControlsTemplate postBucket = (BucketAccessControlsTemplate) postParams.get("template");
|
||||
return bindToRequest(request, postBucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class BucketBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) throws IllegalArgumentException {
|
||||
BucketTemplate postBucket = (BucketTemplate) postParams.get("template");
|
||||
return bindToRequest(request, postBucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class ComposeObjectBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) throws IllegalArgumentException{
|
||||
ComposeObjectTemplate postCompose = (ComposeObjectTemplate) postParams.get("template");
|
||||
return bindToRequest(request, postCompose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.DefaultObjectAccessControlsTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class DefaultObjectAccessControlsBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
DefaultObjectAccessControlsTemplate template = (DefaultObjectAccessControlsTemplate) postParams.get("template");
|
||||
return bindToRequest(request, template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -16,10 +16,11 @@
|
|||
*/
|
||||
package org.jclouds.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE;
|
||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -32,40 +33,32 @@ import org.jclouds.rest.MapBinder;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class MultipartUploadBinder implements MapBinder {
|
||||
|
||||
private final String BOUNDARY_HEADER = "multipart_boundary";
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams)
|
||||
throws IllegalArgumentException {
|
||||
private static final String BOUNDARY_HEADER = "multipart_boundary";
|
||||
|
||||
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
ObjectTemplate template = (ObjectTemplate) postParams.get("template");
|
||||
Payload payload = (Payload) postParams.get("payload");
|
||||
|
||||
String contentType = checkNotNull(template.getContentType(), "contentType");
|
||||
Long length = checkNotNull(template.getSize(), "contetLength");
|
||||
Long length = checkNotNull(template.getSize(), "contentLength");
|
||||
|
||||
StringPayload jsonPayload = Payloads.newStringPayload(new Gson().toJson(template));
|
||||
|
||||
payload.getContentMetadata().setContentLength(length);
|
||||
|
||||
Part jsonPart = Part.create("Metadata", jsonPayload,
|
||||
new Part.PartOptions().contentType(MediaType.APPLICATION_JSON));
|
||||
Part jsonPart = Part.create("Metadata", jsonPayload, new Part.PartOptions().contentType(APPLICATION_JSON));
|
||||
Part mediaPart = Part.create(template.getName(), payload, new Part.PartOptions().contentType(contentType));
|
||||
|
||||
MultipartForm compPayload = new MultipartForm(BOUNDARY_HEADER, jsonPart, mediaPart);
|
||||
request.setPayload(compPayload);
|
||||
// HeaderPart
|
||||
request.toBuilder().replaceHeader(HttpHeaders.CONTENT_TYPE, "Multipart/related; boundary= " + BOUNDARY_HEADER)
|
||||
.build();
|
||||
request.toBuilder().replaceHeader(CONTENT_TYPE, "Multipart/related; boundary= " + BOUNDARY_HEADER).build();
|
||||
return request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
@Override public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class ObjectAccessControlsBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) throws IllegalArgumentException{
|
||||
ObjectAccessControlsTemplate postBucket = (ObjectAccessControlsTemplate) postParams.get("template");
|
||||
return bindToRequest(request, postBucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF 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.googlecloudstorage.binders;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
public class ResumableUploadBinder implements MapBinder {
|
||||
|
||||
@Inject
|
||||
private BindToJsonPayload jsonBinder;
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams)
|
||||
throws IllegalArgumentException {
|
||||
ObjectTemplate template = (ObjectTemplate) postParams.get("template");
|
||||
return bindToRequest(request, template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return jsonBinder.bindToRequest(request, input);
|
||||
}
|
||||
}
|
|
@ -24,9 +24,7 @@ import org.jclouds.rest.MapBinder;
|
|||
|
||||
public class UploadBinder implements MapBinder {
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams)
|
||||
throws IllegalArgumentException {
|
||||
@Override public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
Payload payload = (Payload) postParams.get("payload");
|
||||
|
||||
request.getPayload().getContentMetadata().setContentType(payload.getContentMetadata().getContentType());
|
||||
|
@ -34,8 +32,7 @@ public class UploadBinder implements MapBinder {
|
|||
return bindToRequest(request, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
@Override public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
return request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import javax.ws.rs.Produces;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.googlecloudstorage.binders.BucketAccessControlsBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.BucketAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.ListBucketAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.templates.BucketAccessControlsTemplate;
|
||||
|
@ -40,9 +39,7 @@ import org.jclouds.oauth.v2.config.OAuthScopes;
|
|||
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PATCH;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
@ -96,9 +93,8 @@ public interface BucketAccessControlsApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/b/{bucket}/acl")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(BucketAccessControlsBinder.class)
|
||||
BucketAccessControls createBucketAccessControls(@PathParam("bucket") String bucketName,
|
||||
@PayloadParam("template") BucketAccessControlsTemplate template);
|
||||
@BinderParam(BindToJsonPayload.class) BucketAccessControlsTemplate template);
|
||||
|
||||
/**
|
||||
* Permanently deletes the ACL entry for the specified entity on the specified bucket.
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
|
||||
import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists;
|
||||
import org.jclouds.googlecloudstorage.binders.BucketBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.Bucket;
|
||||
import org.jclouds.googlecloudstorage.domain.ListPage;
|
||||
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
||||
|
@ -50,9 +49,7 @@ import org.jclouds.oauth.v2.config.OAuthScopes;
|
|||
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PATCH;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
@ -136,9 +133,8 @@ public interface BucketApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/b")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(BucketBinder.class)
|
||||
@Fallback(NullOnBucketAlreadyExists.class)
|
||||
Bucket createBucket(@QueryParam("project") String projectId, @PayloadParam("template") BucketTemplate bucketTemplate);
|
||||
Bucket createBucket(@QueryParam("project") String projectId, @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate);
|
||||
|
||||
/**
|
||||
* Creates a new Bucket
|
||||
|
@ -158,10 +154,9 @@ public interface BucketApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/b")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(BucketBinder.class)
|
||||
@Fallback(NullOnKeyAlreadyExists.class)
|
||||
Bucket createBucket(@QueryParam("project") String projectId,
|
||||
@PayloadParam("template") BucketTemplate bucketTemplate, InsertBucketOptions options);
|
||||
@BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, InsertBucketOptions options);
|
||||
|
||||
/**
|
||||
* Permanently deletes an empty Bucket.If bucket is not empty 409 error to indicate the conflict.
|
||||
|
|
|
@ -31,20 +31,17 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.googlecloudstorage.binders.DefaultObjectAccessControlsBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.DefaultObjectAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.ListDefaultObjectAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.googlecloudstorage.domain.ListDefaultObjectAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.templates.DefaultObjectAccessControlsTemplate;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.oauth.v2.config.OAuthScopes;
|
||||
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PATCH;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
@ -97,9 +94,8 @@ public interface DefaultObjectAccessControlsApi {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("/b/{bucket}/defaultObjectAcl")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(DefaultObjectAccessControlsBinder.class)
|
||||
DefaultObjectAccessControls createDefaultObjectAccessControls(@PathParam("bucket") String bucketName,
|
||||
@PayloadParam("template") DefaultObjectAccessControlsTemplate template);
|
||||
@BinderParam(BindToJsonPayload.class) DefaultObjectAccessControlsTemplate template);
|
||||
|
||||
/**
|
||||
* Permanently deletes the DefaultObjectAcessControl entry for the specified entity on the specified bucket.
|
||||
|
|
|
@ -31,7 +31,6 @@ import javax.ws.rs.QueryParam;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.googlecloudstorage.binders.ObjectAccessControlsBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.ListObjectAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
|
||||
|
@ -40,9 +39,7 @@ import org.jclouds.oauth.v2.config.OAuthScopes;
|
|||
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PATCH;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
@ -126,9 +123,9 @@ public interface ObjectAccessControlsApi {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("/b/{bucket}/o/{object}/acl")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(ObjectAccessControlsBinder.class)
|
||||
ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName,
|
||||
@PathParam("object") String objectName, @PayloadParam("template") ObjectAccessControlsTemplate template);
|
||||
@PathParam("object") String objectName,
|
||||
@BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template);
|
||||
|
||||
/**
|
||||
* Creates a new acl entry for specified object
|
||||
|
@ -150,9 +147,9 @@ public interface ObjectAccessControlsApi {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("/b/{bucket}/o/{object}/acl")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(ObjectAccessControlsBinder.class)
|
||||
ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName,
|
||||
@PathParam("object") String objectName, @PayloadParam("template") ObjectAccessControlsTemplate template,
|
||||
@PathParam("object") String objectName,
|
||||
@BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template,
|
||||
@QueryParam("generation") Long generation);
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,6 @@ import javax.ws.rs.core.MediaType;
|
|||
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
|
||||
import org.jclouds.googlecloudstorage.binders.ComposeObjectBinder;
|
||||
import org.jclouds.googlecloudstorage.binders.MultipartUploadBinder;
|
||||
import org.jclouds.googlecloudstorage.binders.UploadBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
||||
|
@ -59,10 +58,10 @@ import org.jclouds.rest.annotations.Fallback;
|
|||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PATCH;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
/**
|
||||
|
@ -387,10 +386,9 @@ public interface ObjectApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(ComposeObjectBinder.class)
|
||||
GCSObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
||||
@PathParam("destinationObject") String destinationObject,
|
||||
@PayloadParam("template") ComposeObjectTemplate composeObjectTemplate);
|
||||
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate);
|
||||
|
||||
/**
|
||||
* Concatenates a list of existing objects into a new object in the same bucket.
|
||||
|
@ -411,10 +409,10 @@ public interface ObjectApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(ComposeObjectBinder.class)
|
||||
GCSObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
||||
@PathParam("destinationObject") String destinationObject,
|
||||
@PayloadParam("template") ComposeObjectTemplate composeObjectTemplate, ComposeObjectOptions options);
|
||||
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate,
|
||||
ComposeObjectOptions options);
|
||||
|
||||
/**
|
||||
* Copies an object to a specified location. Optionally overrides metadata.
|
||||
|
@ -485,6 +483,6 @@ public interface ObjectApi {
|
|||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(MultipartUploadBinder.class)
|
||||
GCSObject multipartUpload(@PathParam("bucket") String bucketName,
|
||||
@PayloadParam("template") ObjectTemplate objectTemplate, @PayloadParam("payload") Payload payload);
|
||||
|
||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate,
|
||||
@PayloadParam("payload") Payload payload);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import javax.ws.rs.PathParam;
|
|||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.googlecloudstorage.binders.ResumableUploadBinder;
|
||||
import org.jclouds.googlecloudstorage.binders.UploadBinder;
|
||||
import org.jclouds.googlecloudstorage.domain.ResumableUpload;
|
||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
||||
|
@ -38,12 +37,14 @@ import org.jclouds.googlecloudstorage.parser.ParseToResumableUpload;
|
|||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.oauth.v2.config.OAuthScopes;
|
||||
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.QueryParams;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.ResponseParser;
|
||||
import org.jclouds.rest.annotations.SkipEncoding;
|
||||
import org.jclouds.rest.binders.BindToJsonPayload;
|
||||
|
||||
/**
|
||||
* Provides Resumable Upload support via Rest API
|
||||
|
@ -105,12 +106,11 @@ public interface ResumableUploadApi {
|
|||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/upload/storage/v1/b/{bucket}/o")
|
||||
@OAuthScopes(STORAGE_FULLCONTROL_SCOPE)
|
||||
@MapBinder(ResumableUploadBinder.class)
|
||||
@ResponseParser(ParseToResumableUpload.class)
|
||||
ResumableUpload initResumableUpload(@PathParam("bucket") String bucketName,
|
||||
@HeaderParam("X-Upload-Content-Type") String contentType,
|
||||
@HeaderParam("X-Upload-Content-Length") Long contentLength,
|
||||
@PayloadParam("template") ObjectTemplate metadata);
|
||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate metadata);
|
||||
|
||||
/**
|
||||
* Stores a new object
|
||||
|
|
Loading…
Reference in New Issue