BluemixObjectStorage
Installation
npm install --save bluemix-objectstorage
Usage
var ObjectStorage = ObjectStorage;
ObjectStorage
Use an ObjectStorage
instance to connect to the IBM Object Storage service and manage containers.
Pass in a credentials object containing projectId, userId, password, and region to the ObjectStorage
constructor in order to establish a connection with the IBM Object Storage service on Bluemix
var credentials = projectId: 'project-id' userId: 'user-id' password: 'password' region: ObjectStorageRegionDALLAS;var objStorage = credentials;
Note: If a credentials object is not passed into the
ObjectStorage
constructor, then the constructor will attempt to read the appropriate values fromVCAP_SERVICES
. If no entry for Object Storage can be found inVCAP_SERVICES
, then an error will be thrown.
Retrieve a list of existing containers
objstorage ;}
Create a new container
objstorage ;}
Retrieve an existing container
objstorage ;}
Delete an existing container
objstorage ;
Note: A container MUST be empty in order for it to be deleted.
Update/Create account metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';objstorage ;}
Retrieve account metadata
objstorage ;
Delete account metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';objstorage ;
ObjectStorageContainer
Use ObjectStorageContainer
instance to manage objects inside of particular container
Create a new object or update an existing one
container ;
Retrieve an existing object
container ;
Retrieve a list of existing objects
container ;
Delete an existing object
container ;
Update/Create container metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';container ;}
Retrieve container metadata
container ;
Delete container metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';container ;
ObjectStorageObject
Use ObjectStorageObject
instance to load object content on demand
Load the object content
object ;
Update/Create object metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';object ;}
Retrieve object metadata
object ;
Delete object metadata
var metadata = 'some-key': 'some-value' 'another-key': 'another-value';object ;
License
Copyright 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.