C# Class EsuApiLib.Rest.EsuRestApi

Implements the REST version of the ESU API. This class uses HttpWebRequest to perform object and metadata calls against the ESU server. All of the methods that communicate with the server are atomic and stateless so the object can be used safely in a multithreaded environment.
Inheritance: EsuApi
Exibir arquivo Open project: EMCECS/atmos-dotnet Class Usage Examples

Protected Properties

Property Type Description
port int
protocol string

Public Methods

Method Description
CalculateServerOffset ( ) : int

Calculates the time offset between the server and the local system in seconds. You can set this value on the ServerOffset property to adjust outgoing timestamps to account for clock skew. Resolution is one second.

CreateAccessToken ( Identifier id, PolicyType policy, Acl acl ) : Uri

Creates an anonymous access token using the specified policy and ACL

CreateObject ( Acl acl, MetadataList metadata, byte data, string mimeType ) : ObjectId

Creates a new object in the cloud.

CreateObject ( Acl acl, MetadataList metadata, byte data, string mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud.

CreateObjectFromSegment ( Acl acl, MetadataList metadata, ArraySegment data, string mimeType ) : ObjectId

Creates a new object in the cloud using an ArraySegment.

CreateObjectFromSegment ( Acl acl, MetadataList metadata, ArraySegment data, string mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud using an ArraySegment.

CreateObjectFromSegmentOnPath ( ObjectPath path, Acl acl, MetadataList metadata, ArraySegment data, String mimeType ) : ObjectId

Creates a new object in the cloud using a BufferSegment on the given path.

CreateObjectFromSegmentOnPath ( ObjectPath path, Acl acl, MetadataList metadata, ArraySegment data, String mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud using a BufferSegment on the given path.

CreateObjectFromSegmentWithKey ( ObjectKey key, Acl acl, MetadataList metadata, ArraySegment data, String mimeType ) : ObjectId

Creates a new object in the cloud with the given key (and key-pool).

CreateObjectFromSegmentWithKey ( ObjectKey key, Acl acl, MetadataList metadata, ArraySegment data, String mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud with the given key (and key-pool).

CreateObjectFromStream ( Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud reading the content a Stream.

CreateObjectFromStreamOnPath ( ObjectPath path, Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud reading the content a Stream.

CreateObjectFromStreamWithKey ( ObjectKey key, Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud with the given key (and key-pool).

CreateObjectOnPath ( ObjectPath path, Acl acl, MetadataList metadata, byte data, String mimeType ) : ObjectId

Creates a new object in the cloud on the given path.

CreateObjectOnPath ( ObjectPath path, Acl acl, MetadataList metadata, byte data, String mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud on the given path.

CreateObjectWithKey ( ObjectKey key, Acl acl, MetadataList metadata, byte data, String mimeType ) : ObjectId

Creates a new object in the cloud with the given key (and key-pool).

CreateObjectWithKey ( ObjectKey key, Acl acl, MetadataList metadata, byte data, String mimeType, Checksum checksum ) : ObjectId

Creates a new object in the cloud with the given key (and key-pool).

CreateSubtenant ( ) : string

Creates a new Atmos subtenant in ECS using the default Replication Group from the Namespace. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.

CreateSubtenant ( string replicationGroupId ) : string

Creates a new Atmos subtenant in ECS. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.

DeleteAccessToken ( Uri tokenUri ) : void

Deletes the specified access token. Implementation simply extracts the token ID from the URL and calls deleteAccessToken(String).

DeleteAccessToken ( string tokenId ) : void

Deletes the specified access token.

DeleteObject ( Identifier id ) : void

Deletes an object from the cloud.

DeleteSubtenant ( string subtenantId ) : void

Deletes an Atmos subtenant from ECS. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.

DeleteUserMetadata ( Identifier id, MetadataTags tags ) : void

Deletes metadata items from an object.

DeleteVersion ( ObjectId vId ) : void

Deletes a version from an object. You cannot specify the base version of an object.

EsuRestApi ( string host, int port, string uid, string sharedSecret ) : System

Creates a new EsuRestApi object

GetAccessToken ( Uri tokenUri ) : AccessTokenType

Retrieves details about the specified access token. Implementation simply extracts the token ID from the URL and calls GetAccessToken(String).

GetAccessToken ( string tokenId ) : AccessTokenType

Retrieves details about the specified access token.

GetAcl ( Identifier id ) : Acl

Returns an object's ACL

GetAllMetadata ( Identifier id ) : ObjectMetadata

Returns all of an object's metadata and its ACL in one call.

GetHost ( ) : string

Gets the name or IP of the host this object connects to.

GetListableTags ( MetadataTag tag ) : MetadataTags

Returns the set of listable tags for the current Tennant.

GetListableTags ( string tag ) : MetadataTags

Returns the set of listable tags for the current Tennant.

GetObjectInfo ( Identifier id ) : ObjectInfo

Gets Replica, Expiration, and Retention information for an object

GetPort ( ) : int

Gets the port number this object connects to.

GetServiceInformation ( ) : ServiceInformation

Gets information about the connected service. Currently, this is only the version of Atmos.

GetShareableUrl ( Identifier id, System.DateTime expiration ) : Uri

An Atmos user (UID) can construct a pre-authenticated URL to an object, which may then be used by anyone to retrieve the object (e.g., through a browser). This allows an Atmos user to let a non-Atmos user download a specific object. The entire object/file is read.

GetShareableUrl ( Identifier id, System.DateTime expiration, string disposition ) : Uri

Creates a shareable URL with the specified content-disposition. This disposition value will be returned in the Content-Disposition response header.

GetSystemMetadata ( Identifier id, MetadataTags tags ) : MetadataList

Fetches the system metadata for the object.

GetUid ( ) : string

Gets the UID used for this object's connections.

GetUserMetadata ( Identifier id, MetadataTags tags ) : MetadataList

Fetches the user metadata for the object.

ListAccessTokens ( ListOptions options ) : List

Lists all access tokens owned by the user using the options provided.

ListDirectory ( ObjectPath path ) : List

Lists the contents of a directory.

ListDirectory ( ObjectPath path, ListOptions options ) : List

Lists the contents of a directory.

ListObjects ( MetadataTag tag ) : List

Lists all objects with the given tag.

ListObjects ( string tag ) : List

Lists all objects with the given tag.

ListObjects ( MetadataTag tag, ListOptions options ) : List

Lists all objects with the given tag.

ListObjects ( string tag, ListOptions options ) : List

Lists all objects with the given tag.

ListObjectsWithMetadata ( MetadataTag tag ) : List

Lists all objects with the given tag. This method returns both the objects' IDs as well as their metadata.

ListObjectsWithMetadata ( string tag ) : List

Lists all objects with the given tag. This method returns both the objects' IDs as well as their metadata.

ListUserMetadataTags ( Identifier id ) : MetadataTags

Returns the list of user metadata tags assigned to the object.

ListVersions ( Identifier id ) : List

Lists the versions of an object.

QueryObjects ( string xquery ) : List

Executes a query for objects matching the specified XQuery string.

ReadObject ( Identifier id, Extent extent, byte buffer ) : byte[]

Reads an object's content.

ReadObject ( Identifier id, Extent extent, byte buffer, Checksum checksum ) : byte[]

Reads an object's content.

ReadObjectExtents ( Identifier id ) : MultipartEntity

Reads content from multiple extents within an object using a single call.

ReadObjectStream ( Identifier id, Extent extent ) : ReadObjectStreamResponse

Fetches object content as a stream

Rename ( ObjectPath source, ObjectPath destination, bool force ) : void

Renames a file or directory within the namespace.

RestoreVersion ( ObjectId id, ObjectId vId ) : void

Restores a version of an object to the base version (i.e. "promote" an old version to the current version).

Set100Continue ( bool enabled ) : void

By default, when posting data .Net will not post a body on the first request and tell the server it expects "100 Continue". After getting "100 Continue" it then posts the data. This is done to avoid sending the body when redirects or errors occur but can be detrimental to performance since more round trips are required.

SetAcl ( Identifier id, Acl acl ) : void

Sets the access control list on the object.

SetUserMetadata ( Identifier id, MetadataList metadata ) : void

Writes the metadata into the object. If the tag does not exist, it is created and set to the corresponding value. If the tag exists, the existing value is replaced.

UpdateObject ( Identifier id, Acl acl, MetadataList metadata, Extent extent, byte data, string mimeType ) : void

Updates an object in the cloud.

UpdateObject ( Identifier id, Acl acl, MetadataList metadata, Extent extent, byte data, string mimeType, Checksum checksum ) : void

Updates an object in the cloud.

UpdateObjectFromSegment ( Identifier id, Acl acl, MetadataList metadata, Extent extent, ArraySegment data, string mimeType ) : void

Updates an object in the cloud.

UpdateObjectFromSegment ( Identifier id, Acl acl, MetadataList metadata, Extent extent, ArraySegment data, string mimeType, Checksum checksum ) : void

Updates an object in the cloud.

UpdateObjectFromStream ( Identifier id, Acl acl, MetadataList metadata, Extent extent, Stream data, long streamLength, string mimeType, Checksum checksum ) : void

Updates an object in the cloud.

VersionObject ( Identifier id ) : ObjectId

Creates a new immutable version of an object.

getShareableUrl ( Identifier id, System.DateTime expiration ) : Uri

An Atmos user (UID) can construct a pre-authenticated URL to an object, which may then be used by anyone to retrieve the object (e.g., through a browser). This allows an Atmos user to let a non-Atmos user download a specific object. The entire object/file is read.

Protected Methods

Method Description
buildUrl ( string resource ) : Uri

Private Methods

Method Description
addDateHeader ( string>.Dictionary headers ) : void
createWebRequest ( Uri u ) : HttpWebRequest
formatTag ( Metadata meta ) : string
getChildByName ( string name, XmlNodeList children ) : XmlNode
getIds ( List list ) : List
getResourcePath ( string ctx, Identifier id ) : string
handleError ( HttpWebResponse resp ) : void
join ( List list, string delim ) : string

Joins a list of values with a delimiter

normalizeHeaderValue ( string p ) : string
parseDirectoryList ( byte dir, ObjectPath path ) : List
parseObjectList ( string responseStr ) : List
parseObjectListWithMetadata ( string responseStr ) : List
parseServiceInformation ( string responseStr, NameValueCollection headers ) : ServiceInformation
parseVersionList ( string responseStr ) : List
processAcl ( Acl acl, string>.Dictionary headers ) : void
processMetadata ( MetadataList metadata, string>.Dictionary headers ) : void
processTags ( MetadataTags tags, string>.Dictionary headers ) : void
readAcl ( Acl acl, string header, EsuApiLib type ) : void
readMetadata ( MetadataList meta, string header, bool listable ) : void
readResponse ( HttpWebResponse resp, byte buffer, Extent extent ) : byte[]
readTags ( MetadataTags tags, string header, bool listable ) : void
sign ( byte hashBytes ) : string
signRequest ( HttpWebRequest con, string method, string resource, string>.Dictionary headers ) : void
utf8Decode ( string encodedValue ) : string
utf8Encode ( string rawValue ) : string
writeRequestBodyFromStream ( HttpWebRequest con, Stream data, long streamLength ) : void

Method Details

CalculateServerOffset() public method

Calculates the time offset between the server and the local system in seconds. You can set this value on the ServerOffset property to adjust outgoing timestamps to account for clock skew. Resolution is one second.
public CalculateServerOffset ( ) : int
return int

CreateAccessToken() public method

Creates an anonymous access token using the specified policy and ACL
public CreateAccessToken ( Identifier id, PolicyType policy, Acl acl ) : Uri
id Identifier identifier of the target object for the access token.
policy PolicyType the token policy for the new access token.
acl Acl the ACL that will be assigned to objects created using this access token.
return System.Uri

CreateObject() public method

Creates a new object in the cloud.
public CreateObject ( Acl acl, MetadataList metadata, byte data, string mimeType ) : ObjectId
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObject() public method

Creates a new object in the cloud.
public CreateObject ( Acl acl, MetadataList metadata, byte data, string mimeType, Checksum checksum ) : ObjectId
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromSegment() public method

Creates a new object in the cloud using an ArraySegment.
public CreateObjectFromSegment ( Acl acl, MetadataList metadata, ArraySegment data, string mimeType ) : ObjectId
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObjectFromSegment() public method

Creates a new object in the cloud using an ArraySegment.
public CreateObjectFromSegment ( Acl acl, MetadataList metadata, ArraySegment data, string mimeType, Checksum checksum ) : ObjectId
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromSegmentOnPath() public method

Creates a new object in the cloud using a BufferSegment on the given path.
public CreateObjectFromSegmentOnPath ( ObjectPath path, Acl acl, MetadataList metadata, ArraySegment data, String mimeType ) : ObjectId
path ObjectPath the path to create the object on.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObjectFromSegmentOnPath() public method

Creates a new object in the cloud using a BufferSegment on the given path.
public CreateObjectFromSegmentOnPath ( ObjectPath path, Acl acl, MetadataList metadata, ArraySegment data, String mimeType, Checksum checksum ) : ObjectId
path ObjectPath the path to create the object on.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromSegmentWithKey() public method

Creates a new object in the cloud with the given key (and key-pool).
public CreateObjectFromSegmentWithKey ( ObjectKey key, Acl acl, MetadataList metadata, ArraySegment data, String mimeType ) : ObjectId
key ObjectKey the key-pool and key to use for the new object.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObjectFromSegmentWithKey() public method

Creates a new object in the cloud with the given key (and key-pool).
public CreateObjectFromSegmentWithKey ( ObjectKey key, Acl acl, MetadataList metadata, ArraySegment data, String mimeType, Checksum checksum ) : ObjectId
key ObjectKey the key-pool and key to use for the new object.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data ArraySegment The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromStream() public method

Creates a new object in the cloud reading the content a Stream.
public CreateObjectFromStream ( Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data Stream The initial contents of the object. Note that we will read only 'streamLength' bytes from the stream and do not close it
streamLength long The number of bytes to read from the stream. Must be <= the actual number of bytes in the stream.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromStreamOnPath() public method

Creates a new object in the cloud reading the content a Stream.
public CreateObjectFromStreamOnPath ( ObjectPath path, Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId
path ObjectPath The path to create the new object on
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data Stream The initial contents of the object. Note that we only read 'streamLength' bytes from the stream and do not close the stream.
streamLength long The number of bytes to read from the stream. Must be <= the actual stream length.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectFromStreamWithKey() public method

Creates a new object in the cloud with the given key (and key-pool).
public CreateObjectFromStreamWithKey ( ObjectKey key, Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum ) : ObjectId
key ObjectKey the key-pool and key to use for the new object.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data Stream The initial contents of the object. Note that we will read only 'streamLength' bytes from the stream and do not close it
streamLength long The number of bytes to read from the stream. Must be <= the actual number of bytes in the stream.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectOnPath() public method

Creates a new object in the cloud on the given path.
public CreateObjectOnPath ( ObjectPath path, Acl acl, MetadataList metadata, byte data, String mimeType ) : ObjectId
path ObjectPath the path to create the object on.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObjectOnPath() public method

Creates a new object in the cloud on the given path.
public CreateObjectOnPath ( ObjectPath path, Acl acl, MetadataList metadata, byte data, String mimeType, Checksum checksum ) : ObjectId
path ObjectPath the path to create the object on.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateObjectWithKey() public method

Creates a new object in the cloud with the given key (and key-pool).
public CreateObjectWithKey ( ObjectKey key, Acl acl, MetadataList metadata, byte data, String mimeType ) : ObjectId
key ObjectKey the key-pool and key to use for the new object.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return ObjectId

CreateObjectWithKey() public method

Creates a new object in the cloud with the given key (and key-pool).
public CreateObjectWithKey ( ObjectKey key, Acl acl, MetadataList metadata, byte data, String mimeType, Checksum checksum ) : ObjectId
key ObjectKey the key-pool and key to use for the new object.
acl Acl Access control list for the new object. May be null to use a default ACL
metadata MetadataList Metadata for the new object. May be null for no metadata.
data byte The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.
mimeType String the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return ObjectId

CreateSubtenant() public method

Creates a new Atmos subtenant in ECS using the default Replication Group from the Namespace. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.
public CreateSubtenant ( ) : string
return string

CreateSubtenant() public method

Creates a new Atmos subtenant in ECS. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.
public CreateSubtenant ( string replicationGroupId ) : string
replicationGroupId string Optional. The ECS Replication Group ID to use for the subtenant. If null, the default replication group from the Namespace will be used.
return string

DeleteAccessToken() public method

Deletes the specified access token. Implementation simply extracts the token ID from the URL and calls deleteAccessToken(String).
public DeleteAccessToken ( Uri tokenUri ) : void
tokenUri System.Uri The URL of the access token.
return void

DeleteAccessToken() public method

Deletes the specified access token.
public DeleteAccessToken ( string tokenId ) : void
tokenId string The ID of the access token.
return void

DeleteObject() public method

Deletes an object from the cloud.
public DeleteObject ( Identifier id ) : void
id Identifier The identifier of the object to delete.
return void

DeleteSubtenant() public method

Deletes an Atmos subtenant from ECS. Note: this API is only applicable to ECS and not to native Atmos. Also, note that when calling this API, the UID set on the EsuRestApi object should be a "bare" UID without a prefixing subtenant ID.
public DeleteSubtenant ( string subtenantId ) : void
subtenantId string The ID of the subtenant to delete
return void

DeleteUserMetadata() public method

Deletes metadata items from an object.
public DeleteUserMetadata ( Identifier id, MetadataTags tags ) : void
id Identifier The identifier of the object whose metadata to delete.
tags MetadataTags The list of metadata tags to delete.
return void

DeleteVersion() public method

Deletes a version from an object. You cannot specify the base version of an object.
public DeleteVersion ( ObjectId vId ) : void
vId ObjectId The ObjectID of the version to delete.
return void

EsuRestApi() public method

Creates a new EsuRestApi object
public EsuRestApi ( string host, int port, string uid, string sharedSecret ) : System
host string The hostname or IP address of the ESU server
port int The port on the server to communicate with. Generally this is 80 for HTTP and 443 for HTTPS.
uid string The username to use when connecting to the server
sharedSecret string The Base64 encoded shared secret to use to sign requests to the server.
return System

GetAccessToken() public method

Retrieves details about the specified access token. Implementation simply extracts the token ID from the URL and calls GetAccessToken(String).
public GetAccessToken ( Uri tokenUri ) : AccessTokenType
tokenUri System.Uri The URL of the access token.
return AccessTokenType

GetAccessToken() public method

Retrieves details about the specified access token.
public GetAccessToken ( string tokenId ) : AccessTokenType
tokenId string The ID of the access token.
return AccessTokenType

GetAcl() public method

Returns an object's ACL
public GetAcl ( Identifier id ) : Acl
id Identifier The identifier of the object whose ACL to read
return Acl

GetAllMetadata() public method

Returns all of an object's metadata and its ACL in one call.
public GetAllMetadata ( Identifier id ) : ObjectMetadata
id Identifier the object's identifier.
return ObjectMetadata

GetHost() public method

Gets the name or IP of the host this object connects to.
public GetHost ( ) : string
return string

GetListableTags() public method

Returns the set of listable tags for the current Tennant.
public GetListableTags ( MetadataTag tag ) : MetadataTags
tag MetadataTag The tag whose children to list. If null, only toplevel tags will be returned.
return MetadataTags

GetListableTags() public method

Returns the set of listable tags for the current Tennant.
public GetListableTags ( string tag ) : MetadataTags
tag string The tag whose children to list. If null, only toplevel tags will be returned.
return MetadataTags

GetObjectInfo() public method

Gets Replica, Expiration, and Retention information for an object
public GetObjectInfo ( Identifier id ) : ObjectInfo
id Identifier
return ObjectInfo

GetPort() public method

Gets the port number this object connects to.
public GetPort ( ) : int
return int

GetServiceInformation() public method

Gets information about the connected service. Currently, this is only the version of Atmos.
public GetServiceInformation ( ) : ServiceInformation
return ServiceInformation

GetShareableUrl() public method

An Atmos user (UID) can construct a pre-authenticated URL to an object, which may then be used by anyone to retrieve the object (e.g., through a browser). This allows an Atmos user to let a non-Atmos user download a specific object. The entire object/file is read.
public GetShareableUrl ( Identifier id, System.DateTime expiration ) : Uri
id Identifier the object to generate the URL for
expiration System.DateTime expiration the expiration date of the URL. Note, be sure to ensure your expiration is in UTC (DateTimeKind.Utc)
return System.Uri

GetShareableUrl() public method

Creates a shareable URL with the specified content-disposition. This disposition value will be returned in the Content-Disposition response header.
public GetShareableUrl ( Identifier id, System.DateTime expiration, string disposition ) : Uri
id Identifier the object to generate the URL for
expiration System.DateTime expiration the expiration date of the URL. Note, be sure to ensure your expiration is in UTC (DateTimeKind.Utc)
disposition string the value that will be sent by the server in the Content-Disposition response header
return System.Uri

GetSystemMetadata() public method

Fetches the system metadata for the object.
public GetSystemMetadata ( Identifier id, MetadataTags tags ) : MetadataList
id Identifier the identifier of the object whose system metadata to fetch.
tags MetadataTags A list of system metadata tags to fetch. Optional. If null, all metadata will be fetched.
return MetadataList

GetUid() public method

Gets the UID used for this object's connections.
public GetUid ( ) : string
return string

GetUserMetadata() public method

Fetches the user metadata for the object.
public GetUserMetadata ( Identifier id, MetadataTags tags ) : MetadataList
id Identifier the identifier of the object whose user metadata to fetch.
tags MetadataTags A list of user metadata tags to fetch. Optional. If null, all user metadata will be fetched.
return MetadataList

ListAccessTokens() public method

Lists all access tokens owned by the user using the options provided.
public ListAccessTokens ( ListOptions options ) : List
options ListOptions Options for listing the objects. After calling /// ListAccessTokens, be sure to check the value of the token property to see /// if there are additional results.
return List

ListDirectory() public method

Lists the contents of a directory.
public ListDirectory ( ObjectPath path ) : List
path ObjectPath the path to list. Must be a directory.
return List

ListDirectory() public method

Lists the contents of a directory.
public ListDirectory ( ObjectPath path, ListOptions options ) : List
path ObjectPath the path to list. Must be a directory.
options ListOptions Options for listing the objects. After calling /// ListObjects, be sure to check the value of the token property to see /// if there are additional results.
return List

ListObjects() public method

Lists all objects with the given tag.
if no objects are found (code 1003)
public ListObjects ( MetadataTag tag ) : List
tag MetadataTag Tag the tag to search for
return List

ListObjects() public method

Lists all objects with the given tag.
if no objects are found (code 1003)
public ListObjects ( string tag ) : List
tag string Tag the tag to search for
return List

ListObjects() public method

Lists all objects with the given tag.
if no objects are found (code 1003)
public ListObjects ( MetadataTag tag, ListOptions options ) : List
tag MetadataTag Tag the tag to search for
options ListOptions Options for listing the objects. After calling ListObjects, be sure to check the value of the token property to see if there are additional results.
return List

ListObjects() public method

Lists all objects with the given tag.
if no objects are found (code 1003)
public ListObjects ( string tag, ListOptions options ) : List
tag string Tag the tag to search for
options ListOptions Options for listing the objects. After calling ListObjects, be sure to check the value of the token property to see if there are additional results.
return List

ListObjectsWithMetadata() public method

Lists all objects with the given tag. This method returns both the objects' IDs as well as their metadata.
if no objects are found (code 1003)
public ListObjectsWithMetadata ( MetadataTag tag ) : List
tag MetadataTag Tag the tag to search for
return List

ListObjectsWithMetadata() public method

Lists all objects with the given tag. This method returns both the objects' IDs as well as their metadata.
if no objects are found (code 1003)
public ListObjectsWithMetadata ( string tag ) : List
tag string Tag the tag to search for
return List

ListUserMetadataTags() public method

Returns the list of user metadata tags assigned to the object.
public ListUserMetadataTags ( Identifier id ) : MetadataTags
id Identifier The object whose metadata tags to list
return MetadataTags

ListVersions() public method

Lists the versions of an object.
public ListVersions ( Identifier id ) : List
id Identifier The object whose versions to list.
return List

QueryObjects() public method

Executes a query for objects matching the specified XQuery string.
public QueryObjects ( string xquery ) : List
xquery string The XQuery string to execute against the cloud.
return List

ReadObject() public method

Reads an object's content.
public ReadObject ( Identifier id, Extent extent, byte buffer ) : byte[]
id Identifier the identifier of the object whose content to read.
extent Extent the portion of the object data to read. Optional. If null, the entire object will be read.
buffer byte the buffer to use to read the extent. Must be large enough to read the response or an error will be thrown. If null, a buffer will be allocated to hold the response data. If you pass a buffer that is larger than the extent, only extent.getSize() bytes will be valid.
return byte[]

ReadObject() public method

Reads an object's content.
public ReadObject ( Identifier id, Extent extent, byte buffer, Checksum checksum ) : byte[]
id Identifier the identifier of the object whose content to read.
extent Extent the portion of the object data to read. Optional. If null, the entire object will be read.
buffer byte the buffer to use to read the extent. Must be large enough to read the response or an error will be thrown. If null, a buffer will be allocated to hold the response data. If you pass a buffer that is larger than the extent, only extent.getSize() bytes will be valid.
checksum Checksum checksum if not null, the given checksum object will be used /// to verify checksums during the read operation. Note that only erasure coded objects /// will return checksums *and* if you're reading the object in chunks, you'll have to /// read the data back sequentially to keep the checksum consistent. If the read operation /// does not return a checksum from the server, the checksum operation will be skipped.
return byte[]

ReadObjectExtents() public method

Reads content from multiple extents within an object using a single call.
public ReadObjectExtents ( Identifier id ) : MultipartEntity
id Identifier the identifier of the object whose content to read.
return MultipartEntity

ReadObjectStream() public method

Fetches object content as a stream
public ReadObjectStream ( Identifier id, Extent extent ) : ReadObjectStreamResponse
id Identifier the identifier of the object whose content to read.
extent Extent the portion of the object data to read. Optional. If null, the entire object will be read.
return ReadObjectStreamResponse

Rename() public method

Renames a file or directory within the namespace.
public Rename ( ObjectPath source, ObjectPath destination, bool force ) : void
source ObjectPath The file or directory to rename
destination ObjectPath The new path for the file or directory
force bool If true, the desination file or /// directory will be overwritten. Directories must be empty to be /// overwritten.
return void

RestoreVersion() public method

Restores a version of an object to the base version (i.e. "promote" an old version to the current version).
public RestoreVersion ( ObjectId id, ObjectId vId ) : void
id ObjectId Base object ID (target of the restore)
vId ObjectId Version object ID to restore
return void

Set100Continue() public method

By default, when posting data .Net will not post a body on the first request and tell the server it expects "100 Continue". After getting "100 Continue" it then posts the data. This is done to avoid sending the body when redirects or errors occur but can be detrimental to performance since more round trips are required.
public Set100Continue ( bool enabled ) : void
enabled bool Set to true to enable continue behavior. Set to false to disable it.
return void

SetAcl() public method

Sets the access control list on the object.
public SetAcl ( Identifier id, Acl acl ) : void
id Identifier The identifier of the object whose ACL to change
acl Acl The new ACL for the object.
return void

SetUserMetadata() public method

Writes the metadata into the object. If the tag does not exist, it is created and set to the corresponding value. If the tag exists, the existing value is replaced.
public SetUserMetadata ( Identifier id, MetadataList metadata ) : void
id Identifier The identifier of the object to update
metadata MetadataList Metadata to write to the object.
return void

UpdateObject() public method

Updates an object in the cloud.
public UpdateObject ( Identifier id, Acl acl, MetadataList metadata, Extent extent, byte data, string mimeType ) : void
id Identifier The ID of the object to update
acl Acl Access control list for the new object. Optional, set to NULL to leave the ACL unchanged.
metadata MetadataList Metadata list for the new object. Optional, set to NULL for no changes to the metadata.
extent Extent portion of the object to update. May be null to indicate the whole object is to be replaced. If not null, the extent size must match the data size.
data byte The new contents of the object. May be appended to later. Optional, set to null for no content changes.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return void

UpdateObject() public method

Updates an object in the cloud.
public UpdateObject ( Identifier id, Acl acl, MetadataList metadata, Extent extent, byte data, string mimeType, Checksum checksum ) : void
id Identifier The ID of the object to update
acl Acl Access control list for the new object. Optional, set to NULL to leave the ACL unchanged.
metadata MetadataList Metadata list for the new object. Optional, set to NULL for no changes to the metadata.
extent Extent portion of the object to update. May be null to indicate the whole object is to be replaced. If not null, the extent size must match the data size.
data byte The new contents of the object. May be appended to later. Optional, set to null for no content changes.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return void

UpdateObjectFromSegment() public method

Updates an object in the cloud.
public UpdateObjectFromSegment ( Identifier id, Acl acl, MetadataList metadata, Extent extent, ArraySegment data, string mimeType ) : void
id Identifier The ID of the object to update
acl Acl Access control list for the new object. Optional, set to NULL to leave the ACL unchanged.
metadata MetadataList Metadata list for the new object. Optional, set to NULL for no changes to the metadata.
extent Extent portion of the object to update. May be null to indicate the whole object is to be replaced. If not null, the extent size must match the data size.
data ArraySegment The new contents of the object. May be appended to later. Optional, set to null for no content changes.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
return void

UpdateObjectFromSegment() public method

Updates an object in the cloud.
public UpdateObjectFromSegment ( Identifier id, Acl acl, MetadataList metadata, Extent extent, ArraySegment data, string mimeType, Checksum checksum ) : void
id Identifier The ID of the object to update
acl Acl Access control list for the new object. Optional, set to NULL to leave the ACL unchanged.
metadata MetadataList Metadata list for the new object. Optional, set to NULL for no changes to the metadata.
extent Extent portion of the object to update. May be null to indicate the whole object is to be replaced. If not null, the extent size must match the data size.
data ArraySegment The new contents of the object. May be appended to later. Optional, set to null for no content changes.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return void

UpdateObjectFromStream() public method

Updates an object in the cloud.
public UpdateObjectFromStream ( Identifier id, Acl acl, MetadataList metadata, Extent extent, Stream data, long streamLength, string mimeType, Checksum checksum ) : void
id Identifier The ID of the object to update
acl Acl Access control list for the new object. Optional, set to NULL to leave the ACL unchanged.
metadata MetadataList Metadata list for the new object. Optional, set to NULL for no changes to the metadata.
extent Extent portion of the object to update. May be null to indicate the whole object is to be replaced. If not null, the extent size must match the data size.
data Stream The initial contents of the object. Note that we only read 'streamLength' bytes from the stream and do not close the stream.
streamLength long The number of bytes to read from the stream. Must be <= the actual stream length.
mimeType string the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.
checksum Checksum the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.
return void

VersionObject() public method

Creates a new immutable version of an object.
public VersionObject ( Identifier id ) : ObjectId
id Identifier The object to version
return ObjectId

buildUrl() protected method

protected buildUrl ( string resource ) : Uri
resource string
return System.Uri

getShareableUrl() public method

An Atmos user (UID) can construct a pre-authenticated URL to an object, which may then be used by anyone to retrieve the object (e.g., through a browser). This allows an Atmos user to let a non-Atmos user download a specific object. The entire object/file is read.
public getShareableUrl ( Identifier id, System.DateTime expiration ) : Uri
id Identifier the object to generate the URL for
expiration System.DateTime expiration the expiration date of the URL. Note, be sure to ensure your expiration is in UTC (DateTimeKind.Utc)
return System.Uri

Property Details

port protected_oe property

The port number for Atmos. Generally, this is 80 for HTTP and 443 for HTTPS.
protected int port
return int

protocol protected_oe property

The protocol used. Generally, this is "http", or "https"
protected string protocol
return string