C# 클래스 LitS3.S3Service

Describes how to connect to a particular S3 server.
파일 보기 프로젝트 열기: ngs-doo/revenj 1 사용 예제들

공개 메소드들

메소드 설명
AddObject ( Stream inputStream, long bytes, string bucketName, string key ) : void

Adds an object to S3 by reading the specified amount of data from the given stream.

AddObject ( Stream inputStream, long bytes, string bucketName, string key, string contentType, CannedAcl acl ) : void

Adds an object to S3 by reading the specified amount of data from the given stream.

AddObject ( Stream inputStream, string bucketName, string key ) : void

Adds an object to S3 by reading all the data in the given stream. The stream must support the Length property.

AddObject ( Stream inputStream, string bucketName, string key, string contentType, CannedAcl acl ) : void

Adds an object to S3 by reading all the data in the given stream. The stream must support the Length property.

AddObject ( string bucketName, string key, long bytes, Action action ) : void

Adds an object to S3 by acquiring the upload stream then allowing the given function to handle writing data into it.

AddObject ( string bucketName, string key, long bytes, string contentType, CannedAcl acl, Action action ) : void

Adds an object to S3 by acquiring the upload stream then allowing the given function to handle writing data into it.

AddObjectString ( string contents, string bucketName, string key ) : void

Uploads the contents of a string to S3. This method is only appropriate for small objects and testing. The UTF-8 encoding will be used.

AddObjectString ( string contents, string bucketName, string key, string contentType, CannedAcl acl ) : void

Uploads the contents of a string to S3. This method is only appropriate for small objects and testing. The UTF-8 encoding will be used.

CopyObject ( string bucketName, string sourceKey, string destKey ) : void

Copies an object within a bucket.

CopyObject ( string bucketName, string sourceKey, string destKey, CannedAcl acl ) : void

Copies an object within a bucket and assigns the given canned ACL.

CopyObject ( string sourceBucketName, string sourceKey, string destBucketName, string destKey ) : void

Copies an object from one bucket to another.

CopyObject ( string sourceBucketName, string sourceKey, string destBucketName, string destKey, CannedAcl acl ) : void

Copies an object from one bucket to another with the given canned ACL.

CreateBucket ( string bucketName ) : void

Creates a bucket in the default storage location automatically determined by Amazon.

CreateBucketInEurope ( string bucketName ) : void

Creates a bucket in the Amazon Europe storage location.

DeleteBucket ( string bucketName ) : void

Deletes the bucket with the given name.

DeleteObject ( string bucketName, string key ) : void

Deletes the object in the specified bucket with the specified key.

ForEachBucket ( Action action ) : void

Performs the given action on each of your buckets without loading the list of buckets completely into memory.

ForEachObject ( string bucketName, Action action ) : void

Queries a bucket for a listing of objects it contains and performs the given action on each object. The DefaultDelimiter will be used.

ForEachObject ( string bucketName, string prefix, Action action ) : void

Queries a bucket for a listing of objects it contains and performs the given action on each object. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used.

GetAllBuckets ( ) : IList

Lists all buckets owned by you.

GetAuthorizedUrl ( string bucketName, string key, System.DateTime expires ) : string

Creates a pre-authorized URI valid for performing a GET on the given S3 object in the given bucket. This is useful for constructing a URL to hand over to a 3rd party (such as a web browser). The Uri will automatically expire after the time given. This method itself does not communicate with S3 and will return immediately.

You might expect this method to return a System.Uri instead of a string. It turns out there is a tricky issue with constructing Uri objects from these pre-authenticated url strings: The Uri.ToString() method will convert a properly-encoded "+" character back into a raw "+", which is interpreted by Amazon S3 as a space (standard URI conventions). So the signature will be misread if you were to take the Uri.ToString() and feed it to a browser. So instead, we'll give you a properly escaped URL string which will always work in a browser. If you want to, say, use it in a WebRequest instead, it turns out that WebRequest will leave it escaped properly and everything will work.

GetObject ( string bucketName, string key, Stream outputStream ) : void

Gets an existing object in S3 and copies its data to the given Stream.

GetObject ( string bucketName, string key, Stream outputStream, long &contentLength, string &contentType ) : void

Gets an existing object in S3 and copies its data to the given Stream.

GetObjectStream ( string bucketName, string key ) : Stream

Gets a data stream for an existing object in S3. It is your responsibility to close the Stream when you are finished.

GetObjectStream ( string bucketName, string key, long &contentLength, string &contentType ) : Stream

Gets a data stream for an existing object in S3. It is your responsibility to close the Stream when you are finished.

GetObjectString ( string bucketName, string key ) : string

Downloads an existing object in S3 and loads the entire contents into a string. This is only appropriate for very small objects and for testing.

GetObjectString ( string bucketName, string key, string &contentType ) : string

Downloads an existing object in S3 and loads the entire contents into a string. This is only appropriate for very small objects and for testing.

GetUrl ( string bucketName, string key ) : string

This constructs a Uri suitable for accessing the given object in the given bucket. It is not authorized, so it will only work for objects with anonymous read access. This method itself does not communicate with S3 and will return immediately.

IsBucketInEurope ( string bucketName ) : bool

Queries S3 to determine whether the given bucket resides in the Europe location.

ListAllObjects ( string bucketName ) : IEnumerable

Queries a bucket for a listing of all objects it contains. The DefaultDelimiter will be used.

ListAllObjects ( string bucketName, string prefix ) : IEnumerable

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used.

ListAllObjects ( string bucketName, string prefix, string delimiter ) : IEnumerable

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned.

ListObjects ( string bucketName, string prefix ) : IList

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used. If you expect a large number of objects to be returned, consider using ListAllObjects().

ObjectExists ( string bucketName, string key ) : bool

Returns true if the given object exists in the given bucket.

QueryBucket ( string bucketName ) : BucketAccess

Queries S3 about the existance and ownership of the given bucket name.

S3Service ( ) : System

Creates a new S3Service with the default values.

비공개 메소드들

메소드 설명
AuthorizeRequest ( S3Request request, HttpWebRequest webRequest, string bucketName ) : void
CopyStream ( Stream source, Stream dest, long length, Action progressCallback ) : void
CreateProgressCallback ( string bucketName, string key, long length, EventHandler handler ) : Action

메소드 상세

AddObject() 공개 메소드

Adds an object to S3 by reading the specified amount of data from the given stream.
public AddObject ( Stream inputStream, long bytes, string bucketName, string key ) : void
inputStream Stream
bytes long
bucketName string
key string
리턴 void

AddObject() 공개 메소드

Adds an object to S3 by reading the specified amount of data from the given stream.
public AddObject ( Stream inputStream, long bytes, string bucketName, string key, string contentType, CannedAcl acl ) : void
inputStream Stream
bytes long
bucketName string
key string
contentType string
acl CannedAcl
리턴 void

AddObject() 공개 메소드

Adds an object to S3 by reading all the data in the given stream. The stream must support the Length property.
public AddObject ( Stream inputStream, string bucketName, string key ) : void
inputStream Stream
bucketName string
key string
리턴 void

AddObject() 공개 메소드

Adds an object to S3 by reading all the data in the given stream. The stream must support the Length property.
public AddObject ( Stream inputStream, string bucketName, string key, string contentType, CannedAcl acl ) : void
inputStream Stream
bucketName string
key string
contentType string
acl CannedAcl
리턴 void

AddObject() 공개 메소드

Adds an object to S3 by acquiring the upload stream then allowing the given function to handle writing data into it.
public AddObject ( string bucketName, string key, long bytes, Action action ) : void
bucketName string
key string
bytes long
action Action
리턴 void

AddObject() 공개 메소드

Adds an object to S3 by acquiring the upload stream then allowing the given function to handle writing data into it.
public AddObject ( string bucketName, string key, long bytes, string contentType, CannedAcl acl, Action action ) : void
bucketName string
key string
bytes long
contentType string
acl CannedAcl
action Action
리턴 void

AddObjectString() 공개 메소드

Uploads the contents of a string to S3. This method is only appropriate for small objects and testing. The UTF-8 encoding will be used.
public AddObjectString ( string contents, string bucketName, string key ) : void
contents string
bucketName string
key string
리턴 void

AddObjectString() 공개 메소드

Uploads the contents of a string to S3. This method is only appropriate for small objects and testing. The UTF-8 encoding will be used.
public AddObjectString ( string contents, string bucketName, string key, string contentType, CannedAcl acl ) : void
contents string
bucketName string
key string
contentType string
acl CannedAcl
리턴 void

CopyObject() 공개 메소드

Copies an object within a bucket.
public CopyObject ( string bucketName, string sourceKey, string destKey ) : void
bucketName string
sourceKey string
destKey string
리턴 void

CopyObject() 공개 메소드

Copies an object within a bucket and assigns the given canned ACL.
public CopyObject ( string bucketName, string sourceKey, string destKey, CannedAcl acl ) : void
bucketName string
sourceKey string
destKey string
acl CannedAcl
리턴 void

CopyObject() 공개 메소드

Copies an object from one bucket to another.
public CopyObject ( string sourceBucketName, string sourceKey, string destBucketName, string destKey ) : void
sourceBucketName string
sourceKey string
destBucketName string
destKey string
리턴 void

CopyObject() 공개 메소드

Copies an object from one bucket to another with the given canned ACL.
public CopyObject ( string sourceBucketName, string sourceKey, string destBucketName, string destKey, CannedAcl acl ) : void
sourceBucketName string
sourceKey string
destBucketName string
destKey string
acl CannedAcl
리턴 void

CreateBucket() 공개 메소드

Creates a bucket in the default storage location automatically determined by Amazon.
public CreateBucket ( string bucketName ) : void
bucketName string The name of the bucket, which will be checked against /// the BucketNameChecking.Strict requirements.
리턴 void

CreateBucketInEurope() 공개 메소드

Creates a bucket in the Amazon Europe storage location.
public CreateBucketInEurope ( string bucketName ) : void
bucketName string
리턴 void

DeleteBucket() 공개 메소드

Deletes the bucket with the given name.
public DeleteBucket ( string bucketName ) : void
bucketName string
리턴 void

DeleteObject() 공개 메소드

Deletes the object in the specified bucket with the specified key.
public DeleteObject ( string bucketName, string key ) : void
bucketName string
key string
리턴 void

ForEachBucket() 공개 메소드

Performs the given action on each of your buckets without loading the list of buckets completely into memory.
public ForEachBucket ( Action action ) : void
action Action
리턴 void

ForEachObject() 공개 메소드

Queries a bucket for a listing of objects it contains and performs the given action on each object. The DefaultDelimiter will be used.
public ForEachObject ( string bucketName, Action action ) : void
bucketName string
action Action
리턴 void

ForEachObject() 공개 메소드

Queries a bucket for a listing of objects it contains and performs the given action on each object. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used.
public ForEachObject ( string bucketName, string prefix, Action action ) : void
bucketName string
prefix string
action Action
리턴 void

GetAllBuckets() 공개 메소드

Lists all buckets owned by you.
public GetAllBuckets ( ) : IList
리턴 IList

GetAuthorizedUrl() 공개 메소드

Creates a pre-authorized URI valid for performing a GET on the given S3 object in the given bucket. This is useful for constructing a URL to hand over to a 3rd party (such as a web browser). The Uri will automatically expire after the time given. This method itself does not communicate with S3 and will return immediately.
You might expect this method to return a System.Uri instead of a string. It turns out there is a tricky issue with constructing Uri objects from these pre-authenticated url strings: The Uri.ToString() method will convert a properly-encoded "+" character back into a raw "+", which is interpreted by Amazon S3 as a space (standard URI conventions). So the signature will be misread if you were to take the Uri.ToString() and feed it to a browser. So instead, we'll give you a properly escaped URL string which will always work in a browser. If you want to, say, use it in a WebRequest instead, it turns out that WebRequest will leave it escaped properly and everything will work.
public GetAuthorizedUrl ( string bucketName, string key, System.DateTime expires ) : string
bucketName string
key string
expires System.DateTime
리턴 string

GetObject() 공개 메소드

Gets an existing object in S3 and copies its data to the given Stream.
public GetObject ( string bucketName, string key, Stream outputStream ) : void
bucketName string
key string
outputStream Stream
리턴 void

GetObject() 공개 메소드

Gets an existing object in S3 and copies its data to the given Stream.
public GetObject ( string bucketName, string key, Stream outputStream, long &contentLength, string &contentType ) : void
bucketName string
key string
outputStream Stream
contentLength long
contentType string
리턴 void

GetObjectStream() 공개 메소드

Gets a data stream for an existing object in S3. It is your responsibility to close the Stream when you are finished.
public GetObjectStream ( string bucketName, string key ) : Stream
bucketName string
key string
리턴 Stream

GetObjectStream() 공개 메소드

Gets a data stream for an existing object in S3. It is your responsibility to close the Stream when you are finished.
public GetObjectStream ( string bucketName, string key, long &contentLength, string &contentType ) : Stream
bucketName string
key string
contentLength long
contentType string
리턴 Stream

GetObjectString() 공개 메소드

Downloads an existing object in S3 and loads the entire contents into a string. This is only appropriate for very small objects and for testing.
public GetObjectString ( string bucketName, string key ) : string
bucketName string
key string
리턴 string

GetObjectString() 공개 메소드

Downloads an existing object in S3 and loads the entire contents into a string. This is only appropriate for very small objects and for testing.
public GetObjectString ( string bucketName, string key, string &contentType ) : string
bucketName string
key string
contentType string
리턴 string

GetUrl() 공개 메소드

This constructs a Uri suitable for accessing the given object in the given bucket. It is not authorized, so it will only work for objects with anonymous read access. This method itself does not communicate with S3 and will return immediately.
public GetUrl ( string bucketName, string key ) : string
bucketName string
key string
리턴 string

IsBucketInEurope() 공개 메소드

Queries S3 to determine whether the given bucket resides in the Europe location.
public IsBucketInEurope ( string bucketName ) : bool
bucketName string
리턴 bool

ListAllObjects() 공개 메소드

Queries a bucket for a listing of all objects it contains. The DefaultDelimiter will be used.
public ListAllObjects ( string bucketName ) : IEnumerable
bucketName string
리턴 IEnumerable

ListAllObjects() 공개 메소드

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used.
public ListAllObjects ( string bucketName, string prefix ) : IEnumerable
bucketName string
prefix string
리턴 IEnumerable

ListAllObjects() 공개 메소드

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned.
public ListAllObjects ( string bucketName, string prefix, string delimiter ) : IEnumerable
bucketName string
prefix string
delimiter string
리턴 IEnumerable

ListObjects() 공개 메소드

Queries a bucket for a listing of objects it contains. Only objects with keys beginning with the given prefix will be returned. The DefaultDelimiter will be used. If you expect a large number of objects to be returned, consider using ListAllObjects().
public ListObjects ( string bucketName, string prefix ) : IList
bucketName string
prefix string
리턴 IList

ObjectExists() 공개 메소드

Returns true if the given object exists in the given bucket.
public ObjectExists ( string bucketName, string key ) : bool
bucketName string
key string
리턴 bool

QueryBucket() 공개 메소드

Queries S3 about the existance and ownership of the given bucket name.
public QueryBucket ( string bucketName ) : BucketAccess
bucketName string
리턴 BucketAccess

S3Service() 공개 메소드

Creates a new S3Service with the default values.
public S3Service ( ) : System
리턴 System