1 /**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.jclouds.blobstore;
20
21 import org.jclouds.blobstore.domain.Blob;
22 import org.jclouds.blobstore.domain.BlobBuilder;
23 import org.jclouds.blobstore.internal.RequestSigningUnsupported;
24 import org.jclouds.blobstore.options.GetOptions;
25 import org.jclouds.http.HttpRequest;
26
27 import com.google.inject.ImplementedBy;
28
29 /**
30 * Generates signed requests for blobs. useful in other tools such as backup utilities.
31 *
32 * @author Adrian Cole
33 */
34 @ImplementedBy(RequestSigningUnsupported.class)
35 public interface BlobRequestSigner {
36
37 /**
38 * gets a signed request, including headers as necessary, to access a blob from an external
39 * client.
40 *
41 * @param container
42 * container where the blob resides
43 * @param directory
44 * full path to the blob
45 * @throws UnsupportedOperationException
46 * if not supported by the provider
47 */
48 HttpRequest signGetBlob(String container, String name);
49
50 /**
51 * @param options
52 * @see #signGetBlob(String, String)
53 */
54 HttpRequest signGetBlob(String container, String name, GetOptions options);
55
56 /**
57 * gets a signed request, including headers as necessary, to delete a blob from an external
58 * client.
59 *
60 * @param container
61 * container where the blob resides
62 * @param directory
63 * full path to the blob
64 * @throws UnsupportedOperationException
65 * if not supported by the provider
66 */
67 HttpRequest signRemoveBlob(String container, String name);
68
69 /**
70 * gets a signed request, including headers as necessary, to upload a blob from an external
71 * client.
72 *
73 * <pre>
74 * Blob blob = context.getBlobStore.blobBuilder().name("name").forSigning().contentType("text/plain")
75 * .contentLength(length).build();
76 * </pre>
77 *
78 * @param container
79 * container where the blob resides
80 * @param blob
81 * what to upload
82 * @throws UnsupportedOperationException
83 * if not supported by the provider
84 * @see BlobBuilder#forSigning
85 */
86 HttpRequest signPutBlob(String container, Blob blob);
87 }