检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
This example uploads string Hello OBS to bucket bucketname as object objectname. The example code is as follows: // Create an instance of ObsClient. var obsClient = new ObsClient({ // Hard-coded or plaintext AK/SK are risky.
function (err, result){ if(err){ console.error('Error-->' + err); }else{ console.log('Status-->' + result.CommonMsg.Status); } }); To handle the error codes possibly returned during the operation, see OBS
result.CommonMsg.Status); if(result.CommonMsg.Status < 300 && result.InterfaceResult){ console.log('VersionStatus-->' + result.InterfaceResult.VersionStatus); } } }); To handle the error codes possibly returned during the operation, see OBS
versionId=versionid' }, function (err, result) { if(err){ console.log('Error-->' + err); }else{ console.log('Status-->' + result.CommonMsg.Status); } }); To handle the error codes possibly returned during the operation, see OBS Server-Side
Scenarios Downloading objects Example 1 2 3 4 5 6 7 GET /object01 HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.com Accept: */* Date: WED, 01 Jul 2015 04:24:33 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:NxtSMS0jaVxlLnxlO9awaMTn47s= x-obs-traffic-limit
15 16 17 18 19 20 21 22 23 24 25 26 27 28 HTTP/1.1 200 OK Server: OBS x-obs-request-id: BF260000016435722C11379647A8A00A x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSGGDRUM62QZi3hGP8Fz3gOloYCfZ39U Content-Type: application/xml Date: Mon, 25 Jun 2018 05:37:12 GMT Content-Length:
21 22 23 24 25 26 27 28 HTTP/1.1 200 OK Server: OBS x-obs-request-id: BF2600000164363593F10738B80CACBE x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSpngvwC5TskcLGh7Fz5KRmCFIayuY8p Content-Type: application/xml Date: WED, 01 Jul 2015 03:54:36 GMT Content-Length: 825 <?
The bucket created in the previous example is of the default ACL (private), in the OBS Standard storage class, and in the default region.
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient ( [ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
The owner or grantee ID required in the ACL indicates an account ID, which can be viewed on the My Credentials page of OBS Console.
using a temporary URL generated by the OBS Android SDK, perform the following steps: Call ObsClient.createTemporarySignature to generate a signed URL.
Procedure In the navigation pane of OBS Console, choose Buckets. In the bucket list, click the bucket name you want to go to the Objects page. In the navigation pane, choose Permissions > Bucket Policies. On the Bucket Policies page, click Create.
OBS can be used to process images in a stable, secure, efficient, easy to use, and cost-efficient manner.
("Delete bucket lifecycle response: {0}", response.StatusCode); } catch (ObsException ex) { Console.WriteLine("ErrorCode: {0}", ex.ErrorCode); Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage); } To handle the error codes possibly returned during the operation, see OBS
Console.WriteLine("Delete bucket cors response: {0}", response.StatusCode); } catch (ObsException ex) { Console.WriteLine("ErrorCode: {0}", ex.ErrorCode); Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage); } To handle the error codes possibly returned during the operation, see OBS
"Delete bucket logging response: {0}", putresponse.StatusCode); } catch (ObsException ex) { Console.WriteLine("ErrorCode: {0}", ex.ErrorCode); Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage); } To handle the error codes possibly returned during the operation, see OBS
Console.WriteLine("Delete bucket website response: {0}", response.StatusCode); } catch (ObsException ex) { Console.WriteLine("ErrorCode: {0}", ex.ErrorCode); Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage); } To handle the error codes possibly returned during the operation, see OBS
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient ( [ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
// require 'obs-autoloader.php'; // Declare the namespace. use Obs\ObsClient; // Create an instance of ObsClient. $obsClient = new ObsClient ( [ //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways.
result.InterfaceResult){ console.log('Size-->' + result.InterfaceResult.Size); console.log('ObjectNumber-->' + result.InterfaceResult.ObjectNumber); } } }); To handle the error codes possibly returned during the operation, see OBS