Skip to main content

%Net.Cloud.Storage.Client

class %Net.Cloud.Storage.Client extends %Library.RegisteredObject

Property Inventory

Method Inventory

Parameters

parameter BUFFERLENGTH = 32000;

Properties

property gateway as %External.JavaGateway;
Connection to a Java Gateway
Property methods: gatewayGet(), gatewayGetSwizzled(), gatewayIsValid(), gatewayNewObject(), gatewaySet()
property jclient as %Net.Remote.Object;
Remote Java client object to Azure, Google or S3
Property methods: jclientGet(), jclientGetSwizzled(), jclientIsValid(), jclientNewObject(), jclientSet()

Methods

method BlobExists(bucketName As %String, blobName As %String) as %Boolean
Test if a blob exists
method BucketExists(bucketName As %String) as %Boolean
Test if a bucket exists
method Close()
Close storage client and disconnect Java gateway
method CopyBlob(sourceBucketName As %String, sourceBlobName As %String, targetBucketName As %String, targetBlobName As %String)
Copy a blob from source to target
method CreateBucket(bucketName As %String)
Create a new bucket
classmethod CreateClient(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, Output sc As %Status, endPoint As %String = "") as Client
Factory method to create a cloud storage client. javaServer: Java gateway name, default to default Java gateway. storageProvider: Specify storage provider. 0: Amazon S3, 1: Azure Blob, 2: Google Cloud Storage. credentialsFile: File name containing credentials for specific storage provider. region: Cloud storage region for specific storage provider. sc: returning status code. endPoint: Optional PrivateLink endpoint
method DeleteBlob(bucketName As %String, blobName As %String)
Delete a blob from the cloud
method DeleteBucket(bucketName As %String)
Delete a bucket from the cloud
method DownloadBlobToBStream(bucketName As %String, blobName As %String, start As %BigInt = "", end As %BigInt = "") as %Stream.Object
Download a blob to an IRIS binary stream with byte range * @param start Start position. Counting from 0, inclusive. If negative, set to 0; if empty, entire blob. * @param end End position. Inclusive. If negative, end of blob; if empty, entire blob.
method DownloadBlobToFile(bucketName As %String, blobName As %String, filePath As %String)
Download a blob from the cloud to a file
method DownloadBlobToStream(bucketName As %String, blobName As %String, blobEncoding As %String = "") as %Stream.Object
Download a blob from the cloud to a stream blobEncoding name follows Java convention If blobEncoding = "", the returning stream is %GlobalBinarayStream; otherwise, it is %GlobalCharacterStream.
method DownloadBlobToString(bucketName As %String, blobName As %String, blobEncoding As %String = "") as %String
Download a blob from the cloud to a string blobEncoding: Blob content encoding, the name follows Java convention. If blobEncoding = "", treat the blob content as encoded in UTF-8.
classmethod DownloadBlobWithPresignedUrl(presignedUrl As %String, start As %BigInt = "", end As %BigInt = "", Output outStream As %Stream.GlobalBinary, javaServer As %RawString = "") as %Status
* Download blob with presigned url and byte range to IRIS %Stream.GlobalBinary * @param presignedUrl Presigned url string * @param start Start position. Counting from 0, inclusive. If negative, set to 0; if empty, entire blob. * @param end End position. Inclusive. If negative, end of blob; if empty, entire blob. * @param outStream Output IRIS %Stream.GlobalBinary
method GeneratePresignedUrl(bucketName As %String, blobName As %String, duration As %BigInt, method As %String, metadata As %String = "") as %String
* Generate presigned url * @param bucketName Bucket name * @param blobName Blob name * @param duration Duration in millisecond * @param method Url method * Amazon S3: DELETE, GET, HEAD, PATCH, POST, PUT. * Azure: a subset of "acdrw"(ADD,CREATE,DELETE,READ,WRITE). * GCS: DELETE, GET, HEAD, OPTIONS, POST, PUT. * @param metadata Optional user metadata as json string. * Amazon S3: Needed user metadata must be specified when generating url. The names have prefix "x-amz-meta-". * User metadata cannot be modified in subsequent operations. * Azure: User metadata is ignored. * GCS: Needed user metadata must be specified when generating url. The names have prefix "x-goog-meta-". * The generated signed signature contains user metadata information. * User metadata cannot be modified in subsequent operations. * @return Presigned url string
method GetBlobInfo(bucketName As %String, blobName As %String) as BlobInfo
Get blob info
method GetBlobMetadata(bucketName As %String, blobName As %String) as %String
* Get blob user metadata * @param bucketName Bucket name * @param blobName Blob name * @return User metadata as json string. Metadata names have no prefixes.
classmethod GetBlobMetadataWithPresignedUrl(presignedUrl As %String, Output metadata As %String, javaServer As %RawString = "") as %Status
* Get blob metadata with presigned url * @param presignedUrl Presigned url string * @param metadata Metadata as json string. * Amazon S3: User metadata names have prefix "x-amz-meta-". * Azure: Prefix "x-ms-meta-". * GCS: Prefix "x-goog-meta-". * The metadata are from the http header, they may contain some other name value pairs.
method GetBucketInfo(bucketName As %String) as BucketInfo
Get bucket info
method IDownloadBlobWithPresignedUrl(presignedUrl As %String, start As %BigInt = "", end As %BigInt = "", Output outStream As %Stream.GlobalBinary) as %Status
Instance method version of DownloadBlobWithPresignedUrl(...)
method IGetBlobMetadataWithPresignedUrl(presignedUrl As %String, Output metadata As %String) as %Status
Instance method version of GetBlobMetadataWithPresignedUrl(...)
method IUploadBlobWithPresignedUrl(presignedUrl As %String, input As %Stream.Object, metadataJson As %String = "") as %Status
Instance method version of UploadBlobWithPresignedUrl(...)
method IsBucketPublicAccessible(bucketName As %String) as %Boolean
Test if a bucket is public accessible
method IsBucketWritable(bucketName As %String) as %Boolean
Test if a bucket is writable
method IsGatewayAlive() as %Boolean
Test if the gateway connection is still alive
method ListBlobs(bucketName As %String, blobNamePrefix As %String = "", blobNamePattern As %String = "") as %ListOfObjects
List all blobs within a bucket, filtered by blobNamePrefix and blobNamePattern. bucketName: bucket name blobNamePrefix: blob name prefix, used to filter the result on the server. blobNamePattern: blob name pattern, used to filter the result by the client. Support wild cards "?" and "*".
method ListBuckets() as %ListOfObjects
List all buckets
method MoveBlob(sourceBucketName As %String, sourceBlobName As %String, targetBucketName As %String, targetBlobName As %String)
Move a blob from source to target
classmethod SingleDownloadBlobToFile(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, filePath As %String) as %Status
Single method to download blob to file
classmethod SingleDownloadBlobToStream(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, blobEncoding As %String = "", Output toStream As %Stream.Object) as %Status
Single method to download blob to stream
classmethod SingleDownloadBlobToString(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, blobEncoding As %String = "", Output toString As %String) as %Status
Single method to download blob to string
classmethod SingleUploadBlobFromFile(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, filePath As %String) as %Status
Single method to upload blob from file
classmethod SingleUploadBlobFromStream(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, stream As %Stream.Object) as %Status
Single method to upload blob from stream
classmethod SingleUploadBlobFromString(javaServer As %RawString = "", storageProvider As %Integer, credentialsFile As %String = "", region As %String, endPoint As %String = "", bucketName As %String, blobName As %String, content As %String) as %Status
Single method to upload blob from string
method UploadBlobFromFile(bucketName As %String, blobName As %String, filePath As %String)
Upload a file blob to the cloud
method UploadBlobFromStream(bucketName As %String, blobName As %String, stream As %Stream.Object, metadataJson As %String = "")
Upload a binary or character stream blob to the cloud For character stream, its content is converted to UTF-8 first, then uploaded as binary stream.
method UploadBlobFromString(bucketName As %String, blobName As %String, content As %String)
Upload a string blob to the cloud String content will be encoded as UTF-8
classmethod UploadBlobWithPresignedUrl(presignedUrl As %String, input As %Stream.Object, metadataJson As %String = "", javaServer As %RawString = "") as %Status
* Upload blob with presigned url * @param presignedUrl Presigned url string * @param input Input stream. * @param metadataJson Optional user metadata as json string. * Amazon S3: User metadata are specified when generating the presigned url which should not be provided here. * Additional metadata with name starting with "x-amz-meta-" will cause 403 forbidden error; other user metadata have no effect. * Azure: Prefix "x-ms-meta-" to user metadata names. A mandatory key "x-ms-blob-type" with value "BlockBlob" should be included in the user metadata. * GCS: User metadata need to exactly match the ones specified when generating the presigned url. User metadata names have prefix "x-goog-meta-". * User metadata values cannot be modified.

Inherited Members

Inherited Methods

Subclasses

FeedbackOpens in a new tab