Renaming an Object
Function
This API is used to rename an object in a specified bucket.
This API is supported only by parallel file systems. For details about how to create a parallel file system, see Sample Request: Creating a Parallel File System. Renaming an object is a non-idempotent operation.
Authorization
To call this API, you must be the object owner or have the permission to rename an object. You are advised to use IAM or bucket policies for authorization. For details about OBS authorization methods, see Differences Between OBS Permissions Control Methods.
- If you use IAM for authorization, you need to use either role/policy-based authorization or identity policy-based authorization and configure the required permissions:
- If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you must have the obs:object:PutObject permission. For details, see Creating a Custom IAM Policy.
- If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you must have the obs:object:putObject permission, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.
Action
Access Level
Resource Type (*: Required)
Dependencies
obs:object:putObject
Permission_management
object *
-
- kms:cmk:create
- kms:cmk:list
- kms:cmk:createDataKey
- functiongraph:function:invokeAsync
- functiongraph:workflow:invoke
- smn:topic:publish
-
- obs:EpochTime
- obs:SourceIp
- obs:TlsVersion
- obs:CustomDomain
- obs:x-obs-acl
- If you use bucket policies for authorization, you must have the obs:object:putObject permission. For details, see Creating a Custom Bucket Policy.
URI
POST /{object_key}
Calling Method
For details, see Calling APIs. Before calling this API, calculate the API signature and add it to the request.
You can debug this API in API Explorer.
Request Syntax
POST /ObjectName?name=Name&rename HTTP/1.1 Host: bucketname.obs.region.myhuaweicloud.com Authorization: authorization Date: date
URI Parameters
The request needs to specify parameters in the message, indicating that this is a renaming operation, specifying the new name. Table 1 describes the parameters.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Name of the object after renaming. Constraints An absolute path is required. For example, name=/dir1/file1. Range N/A Default Value N/A |
| rename | Yes | String | Definition If this parameter is carried, the request renames an object. Constraints N/A Range N/A Default Value N/A |
Request Headers
This request uses common headers. For details, see Table 3.
Request Body
This request contains no request body parameters.
Response Syntax
1 2 3 4 5 | HTTP/1.1 204 status_code Server: OBS x-obs-request-id: request-id x-obs-id-2: id Date: Date |
Response Headers
This response uses common headers. For details, see Table 1.
Response Body
This response contains no elements.
Error Responses
No special errors. You can find all errors in Table 2.
Sample Request
POST /ObjectName?name=file2&rename HTTP/1.1 Host: examplebucket.obs.region.myhuaweicloud.com Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw= Date: WED, 01 Jul 2015 04:19:20 GMT
Sample Response
1 2 3 4 5 | HTTP/1.1 204 No Content Server: OBS x-obs-request-id: 8DF400000163D3F51DEA05AC9CA066F1 x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCSgkM4Dij80gAeFY8pAZIwx72QhDeBZ5 Date: WED, 01 Jul 2015 04:19:21 GMT |
Using SDKs to Call APIs
You are advised to use OBS SDKs to call APIs. SDKs encapsulate APIs to simplify development. You can call SDK API functions to access OBS without manually calculating signatures.
Helpful Links
For details about the billing items involved in API operations, see Billing Items.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot