El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Copying Parts

Updated on 2024-04-15 GMT+08:00

Functions

After creating a multipart upload job, you can specify its upload ID and upload a part to the job in OBS. Alternatively, you can make an API call to add a part (part of an object or the whole object).

NOTICE:

You cannot determine whether a request is successful only based on the status_code in the returned HTTP header. If 200 is returned for status_code, the server has received the request and started to process the request. The copy is successful only when the body in the response contains ETag.

Copy the source object and save it as part1. If a part1 already exists before the copying, the original part1 will be overwritten by the newly copied part1. After the copy is successful, only the latest part1 is displayed. The old part1 data will be deleted. Therefore, ensure that the target part does not exist or has no value when using the part copy operation. Otherwise, data may be deleted by mistake. The source object in the copy process does not change.

Request Syntax

PUT /ObjectName?partNumber=partNum&uploadId=UploadID HTTP/1.1 
Host: bucketname.obs.region.example.com
Date: date
x-obs-copy-source: sourceobject
x-obs-copy-source-range:bytes=start-end
Authorization: authorization
Content-Length: length

Request Parameters

To copy a part, you need to specify the part number of the target part and the multipart upload task number. Table 1 describes the parameters.

Table 1 Request parameters

Parameter

Description

Mandatory

partNumber

Indicates the ID of a part to be uploaded.

Type: integer

Yes

uploadId

Indicates a multipart upload ID.

Type: string

Yes

Request Headers

In addition the common message headers, the request uses two extended headers. Table 3 describes the common message header.

Table 2 Request headers

Header

Description

Mandatory

x-obs-copy-source

Indicates the source object to be copied.

Type: string

Yes

x-obs-copy-source-range

Indicates the range of bytes (start - end) to be copied from the source object. start indicates the start byte of the part to be copied and end indicates the end byte.

Type: integer

No

x-obs-copy-source-if-match

Indicates that the source object is copied only if its ETag matches the one specified in this header. Otherwise, a 412 status code (failed precondition) is returned.

Type: string

Example: x-obs-copy-source-if-match: etag

Constraint: This header can be used with x-obs-copy-source-if-unmodified-since but not other conditional copy headers.

No

x-obs-copy-source-if-none-match

Indicates that the source object is copied only if its ETag does not match the one specified in this header. Otherwise, a 412 status code (failed precondition) is returned.

Type: string

Example: x-obs-copy-source-if-none-match: etag

Constraint: This header can be used with x-obs-copy-source-if-modified-since but not other conditional copy headers.

No

x-obs-copy-source-if-unmodified-since

Indicates that the source object is copied only if it has not been modified since the time specified by this header. Otherwise, a 412 status code (failed precondition) is returned. This header can be used with x-obs-copy-source-if-match but not other conditional copy headers.

Type: string

Format: HTTP time string complying with the format specified at http://www.ietf.org/rfc/rfc2616.txt, which can be any of the following:

  1. EEE, dd MMM yyyy HH:mm:ss z
  2. EEEE, dd-MMM-yy HH:mm:ss z
  3. EEE MMM dd HH:mm:ss yyyy

Examples:

  1. x-obs-copy-source-if-unmodified-since: Sun, 06 Nov 1994 08:49:37 GMT
  2. x-obs-copy-source-if-unmodified-since: Sunday, 06-Nov-94 08:49:37 GMT
  3. x-obs-copy-source-if-unmodified-since: Sun Nov 6 08:49:37 1994

Constraint: The time specified by this header cannot be later than the current server time (GMT time), or this header does not take effect.

No

x-obs-copy-source-if-modified-since

Indicates that the source object is copied only if it has been modified since the time specified by this header. Otherwise, a 412 status code (failed precondition) is returned. This header can be used with x-obs-copy-source-if-none-match but not other conditional copy headers.

Type: string

Format: HTTP time string complying with the format specified at http://www.ietf.org/rfc/rfc2616.txt, which can be any of the following:

  1. EEE, dd MMM yyyy HH:mm:ss z
  2. EEEE, dd-MMM-yy HH:mm:ss z
  3. EEE MMM dd HH:mm:ss yyyy

Examples:

  1. x-obs-copy-source-if-unmodified-since: Sun, 06 Nov 1994 08:49:37 GMT
  2. x-obs-copy-source-if-unmodified-since: Sunday, 06-Nov-94 08:49:37 GMT
  3. x-obs-copy-source-if-unmodified-since: Sun Nov 6 08:49:37 1994

Constraint: The time specified by this header cannot be later than the current server time (GMT time), or this header does not take effect.

No

Request Elements

This request involves no elements.

Response Syntax

HTTP/1.1 status_code
Date: date

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<CopyPartResult xmlns="http://obs.region.example.com/doc/2015-06-30/"> 
    <LastModified>modifiedDate</LastModified>  
    <ETag>etag</ETag> 
</CopyPartResult>

Response Headers

The response to the request uses common headers. For details, see Table 1.

Response Elements

This response contains elements of a part copy result. Table 3 describes the elements.

Table 3 Response elements

Element

Description

LastModified

Indicates the latest time an object was modified.

Type: string

ETag

ETag value of the target part. It is the unique identifier of the part content and is used to verify data consistency when merging parts.

Type: string

Error Responses

  1. If the AK or signature is invalid, OBS returns 403 Forbidden and the error code is AccessDenied.
  2. Check whether the source bucket or destination bucket exists. If the source bucket or destination bucket does not exist, OBS returns 404 Not Found and the error code is NoSuchBucket.
  3. If the source object does not exist, OBS returns 404 Not Found and the error code is NoSuchKey.
  4. If the user does not have the read permission for the specified object, OBS returns 403 Forbidden and the error code is AccessDenied.
  5. If the user does not have the write permission for the destination bucket, OBS returns 403 Forbidden and the error code is AccessDenied.
  6. If the specified task does not exist, OBS returns 404 Not Found and the error code is NoSuchUpload.
  7. If the user is not the initiator of the multipart upload task, OBS returns 403 Forbidden and the error code is AccessDenied.
  8. When the size of a copied part has exceeded 5 GB, OBS returns 400 Bad Request.
  9. If a part number is not within the range from 1 to 10000, OBS returns error code 400 Bad Request.

Other errors are included in Table 2.

Sample Request

PUT /tobject02?partNumber=2&uploadId=00000163D40171ED8DF4050919BD02B8 HTTP/1.1
User-Agent: curl/7.29.0
Host: examplebucket.obs.region.example.com
Accept: */*
Date: WED, 01 Jul 2015 05:16:32 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:dSnpnNpawDSsLg/xXxaqFzrAmMw=
x-obs-copy-source: /destbucket/object01

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 200 OK
Server: OBS
x-obs-request-id: 8DF400000163D40ABBD20405D30B0542
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCTIJpD2efLy5o8sTTComwBb2He0j11Ne
Content-Type: application/xml
Date: WED, 01 Jul 2015 05:16:32 GMT
Transfer-Encoding: chunked

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<CopyPartResult xmlns="http://obs.example.com/doc/2015-06-30/">
  <LastModified>2015-07-01T05:16:32.344Z</LastModified>
  <ETag>"3b46eaf02d3b6b1206078bb86a7b7013"</ETag>
</CopyPartResult>

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback