001/**
002 * Copyright 2004-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.common.aws.s3;
017
018import java.io.File;
019
020import org.kuali.common.aws.s3.model.CopyObjectResult;
021import org.kuali.common.aws.s3.model.PutObjectResult;
022
023public interface S3Service {
024
025        /**
026         * Return true if this key exists in this bucket.
027         */
028        boolean exists(String bucket, String key);
029
030        /**
031         * Create a copy of an object inside a bucket
032         */
033        CopyObjectResult copyObject(String bucket, String srcKey, String dstKey);
034
035        /**
036         * Read the contents of an object into a string using UTF8
037         */
038        String readObjectToString(String bucket, String key);
039
040        /**
041         * Write a string to a bucket using UTF8
042         */
043        PutObjectResult writeStringToObject(String bucket, String key, String data);
044
045        /**
046         * Copy a file from the local file system to a bucket using UTF8
047         */
048        PutObjectResult putFile(String bucket, String key, File file);
049
050        /**
051         * Copy a file from the local file system to a bucket using the indicated encoding
052         */
053        PutObjectResult putFile(String bucket, String key, File file, String encoding);
054
055        /**
056         * Return the region we are operating on
057         */
058        String getRegion();
059
060}