检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
ObsClient obsClient = new ObsClient(ak, sk, endPoint); BucketVersioningConfiguration status = obsClient.getBucketVersioning("bucketname"); Log.i("GetBucketVersioning", "\t" + status.getVersioningStatus()); To handle the error codes possibly returned during the operation, see OBS
Each time you want to send an HTTP/HTTPS request to OBS, you must create an instance of ObsClient. Sample code is as follows: // Initialize configuration parameters.
The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
The OBS server will compare this MD5 value with the MD5 value obtained by object data calculation. If the two values are not the same, the upload fails with HTTP status code 400 returned. If the MD5 value is not specified, the OBS server will skip MD5 value verification.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
directcoldaccess HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.com Accept: */* Date: Tue, 30 Apr 2019 03:04:48 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:5DGAS7SBbMC1YTC4tNXY57Zl2Fo= Parent topic: Advanced Bucket Settings
BucketStorageInfo storageInfo = obsClient.getBucketStorageInfo("bucketname"); Log.i("GetBucketStorageInfo", "\t" + storageInfo.getObjectNumber()); Log.i("GetBucketStorageInfo", "\t" + storageInfo.getSize()); To handle the error codes possibly returned during the operation, see OBS
RestoreObjectRequest("bucketname", "objectname", 1); // Restore a versioned object at an expedited speed. request.setRestoreTier(RestoreTierEnum.EXPEDITED); request.setVersionId("versionid"); obsClient.restoreObject(request); To handle the error codes possibly returned during the operation, see OBS
BucketLoggingConfiguration config = obsClient.getBucketLogging("bucketname"); Log.i("GetBucketLoggingConfiguration","\t" + config.getTargetBucketName()); Log.i("GetBucketLoggingConfiguration","\t" + config.getLogfilePrefix()); 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.
// 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.
Bucket: 'bucketname' }, 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
Sample code is as follows: # Import the module. from obs import ObsClient # Create an instance of ObsClient. obsClient = ObsClient( access_key_id=os.getenv("AccessKeyID"), secret_access_key=os.getenv("SecretAccessKey"), server='https://your-endpoint' ) resp = obsClient.putContent
access_key_id: process.env.ACCESS_KEY_ID, secret_access_key: process.env.SECRET_ACCESS_KEY, // If you use a temporary AK/SK pair and a security token to access OBS, you are advised not to use hard coding, which may result in information leakage.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
For details, see Introduction to OBS Access Control, IAM Custom Policies, and Creating a Custom Bucket Policy. The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.
The mapping between OBS regions and endpoints must comply with what is listed in Regions and Endpoints.