Skip to content

Commit b5b1040

Browse files
committed
feat(oms): add oms migration task and migration task group fields
1 parent 6c1291e commit b5b1040

6 files changed

+153
-0
lines changed

docs/resources/oms_migration_task.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,68 @@ The following arguments are supported:
107107
* `smn_config` - (Optional, List, ForceNew) Specifies the SMN message sending configuration.
108108
The [object](#smn_config_object) structure is documented below. Changing this creates a new resource.
109109

110+
* `object_overwrite_mode` - (Optional, String, ForceNew) Specifies whether to skip a source object or allow the source
111+
object to overwrite its paired destination object. Value options are as follows:
112+
113+
+ **NO_OVERWRITE**: indicates the system never allows override. The system always skips source objects and keeps
114+
their paired destination objects.
115+
116+
+ **SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE**: indicates the system allows override based on the results of size or
117+
modification time checks. If a source object is not as large as or was last modified more recently than its paired
118+
destination object, the source object will overwrite the destination object. Otherwise, the source object will be
119+
skipped.
120+
121+
+ **CRC64_COMPARISON_OVERWRITE**: indicates the system allows override if the source and destination objects have
122+
different CRC64 checksums. This option is only available for migration on Huawei Cloud or from Alibaba Cloud or
123+
Tencent Cloud. If a source object has a CRC64 checksum different from the paired destination object, the source
124+
object will overwrite the destination object. Otherwise, the source object will be skipped.
125+
If any of them doesn't have a CRC64 checksum, their sizes and last modification times are checked.
126+
127+
+ **FULL_OVERWRITE**: indicates the system always allows override. The system always allows source objects to
128+
overwrite their paired destination objects.
129+
130+
The default value is **SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE**. Changing this creates a new resource.
131+
132+
* `consistency_check` - (Optional, String, ForceNew) Specifies the consistency check method, which is used to check
133+
whether objects are consistent before and after migration. All check methods take effect for only objects that are
134+
in the same encryption status in the source and destination buckets. The check method and results will be recorded
135+
in the object list. Value options are as follows:
136+
137+
+ **size_last_modified**: the system checks object consistency with object size and last modification time.
138+
If a source object is as large as but was last modified earlier than its paired destination object, the system
139+
considers the source object does not need to be migrated or has been already migrated successfully.
140+
141+
+ **crc64**: this option is only available for migration on Huawei Cloud or from Alibaba Cloud or Tencent Cloud. If
142+
a source object and its paired destination object have CRC64 checksums, the checksums are checked. Otherwise, their
143+
sizes and last modification times are checked.
144+
145+
+ **no_check**: this option is only available for migration of HTTP/HTTPS data. This option takes effect for source
146+
objects whose sizes cannot be obtained using the content-length field in the standard HTTP protocol. These source
147+
objects will overwrite their paired destination objects directly.
148+
If the size of a source object can be obtained, its size and last modification time will be checked.
149+
150+
The default value is **size_last_modified**. Changing this creates a new resource.
151+
152+
* `enable_requester_pays` - (Optional, Bool, ForceNew) Specifies whether to let the requester make payment.
153+
After enabled, the requester pays the request and data transmission fees.
154+
Default value: **false**. Changing this creates a new resource.
155+
156+
* `enable_metadata_migration` - (Optional, Bool, ForceNew) Specifies whether metadata migration is enabled. Even if this
157+
function is disabled, the ContentType metadata will still be migrated to ensure a successful migration.
158+
Default value: **false**. Changing this creates a new resource.
159+
160+
* `task_priority` - (Optional, String, ForceNew) Specifies the task priority.
161+
The value can be **HIGH**, **MEDIUM**, or **LOW**. Changing this creates a new resource.
162+
163+
* `dst_storage_policy` - (Optional, String, ForceNew) Specifies the destination storage class.
164+
This parameter is required only when the destination is Huawei Cloud OBS. The default value is STANDARD.
165+
+ **STANDARD**: OBS Standard storage.
166+
+ **IA**: OBS Infrequent Access storage.
167+
+ **ARCHIVE**: OBS Archive storage
168+
+ **DEEP_ARCHIVE**: OBS Deep Archive storage
169+
+ **SRC_STORAGE_MAPPING**: converts the source storage class into an OBS storage class based on the predefined rules.
170+
Changing this creates a new resource.
171+
110172
<a name="source_object_object"></a>
111173
The `source_object` block supports:
112174

@@ -150,6 +212,12 @@ The `source_object` block supports:
150212
* `list_file_key` - (Optional, String, ForceNew) Specifies the object name of the list file or URL list file.
151213
`list_file_key` is mandatory when `type` is set to **list** or **url_list**. Changing this creates a new resource.
152214

215+
* `list_file_num` - (Optional, String, ForceNew) Specifies the number of stored object list files.
216+
Changing this creates a new resource.
217+
218+
* `json_auth_file` - (Optional, String, ForceNew) Specifies the file used for Google Cloud Storage authentication.
219+
Changing this creates a new resource.
220+
153221
<a name="destination_object_object"></a>
154222
The `destination_object` block supports:
155223

@@ -216,6 +284,10 @@ The `smn_config` block supports:
216284
* `language` - (Optional, String, ForceNew) Specifies the SMN message language. The value can be **zh-cn** or
217285
**en-us**. Default value: **en-us**. Changing this creates a new resource.
218286

287+
* `message_template_name` - (Optional, String, ForceNew) Specifies the message template name.
288+
If this parameter is specified, SMN messages are sent using the specified template.
289+
Changing this creates a new resource.
290+
219291
## Attribute Reference
220292

221293
In addition to all arguments above, the following attributes are exported:

docs/resources/oms_migration_task_group.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ The following arguments are supported:
226226
name during migration. The [object](#source_cdn_object) structure is documented below.
227227
Changing this creates a new resource.
228228

229+
* `enable_metadata_migration` - (Optional, Bool, ForceNew) Specifies whether metadata migration is enabled. Even if this
230+
function is disabled, the ContentType metadata will still be migrated to ensure a successful migration.
231+
Default value: **false**. Changing this creates a new resource.
232+
233+
* `dst_storage_policy` - (Optional, String, ForceNew) Specifies the destination storage class.
234+
This parameter is required only when the destination is Huawei Cloud OBS. The default value is STANDARD.
235+
+ **STANDARD**: OBS Standard storage.
236+
+ **IA**: OBS Infrequent Access storage.
237+
+ **ARCHIVE**: OBS Archive storage
238+
+ **DEEP_ARCHIVE**: OBS Deep Archive storage
239+
+ **SRC_STORAGE_MAPPING**: converts the source storage class into an OBS storage class based on the predefined rules.
240+
Changing this creates a new resource.
241+
229242
<a name="source_object_object"></a>
230243
The `source_object` block supports:
231244

huaweicloud/services/acceptance/oms/resource_huaweicloud_oms_migration_task_group_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ resource "huaweicloud_oms_migration_task_group" "test" {
226226
consistency_check = "crc64"
227227
enable_requester_pays = true
228228
enable_failed_object_recording = true
229+
enable_metadata_migration = true
229230
230231
bandwidth_policy {
231232
max_bandwidth = 1

huaweicloud/services/acceptance/oms/resource_huaweicloud_oms_migration_task_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ resource "huaweicloud_oms_migration_task" "test" {
205205
type = "object"
206206
description = "test task"
207207
208+
enable_metadata_migration = true
209+
208210
bandwidth_policy {
209211
max_bandwidth = 1
210212
start = "15:00"

huaweicloud/services/oms/resource_huaweicloud_oms_migration_task.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ func ResourceMigrationTask() *schema.Resource {
127127
"source_object.0.list_file_bucket",
128128
},
129129
},
130+
"list_file_num": {
131+
Type: schema.TypeString,
132+
Optional: true,
133+
ForceNew: true,
134+
},
135+
"json_auth_file": {
136+
Type: schema.TypeString,
137+
Optional: true,
138+
ForceNew: true,
139+
},
130140
},
131141
},
132142
},
@@ -290,9 +300,44 @@ func ResourceMigrationTask() *schema.Resource {
290300
Optional: true,
291301
ForceNew: true,
292302
},
303+
"message_template_name": {
304+
Type: schema.TypeString,
305+
Optional: true,
306+
ForceNew: true,
307+
},
293308
},
294309
},
295310
},
311+
"enable_metadata_migration": {
312+
Type: schema.TypeBool,
313+
Optional: true,
314+
ForceNew: true,
315+
},
316+
"dst_storage_policy": {
317+
Type: schema.TypeString,
318+
Optional: true,
319+
ForceNew: true,
320+
},
321+
"task_priority": {
322+
Type: schema.TypeString,
323+
Optional: true,
324+
ForceNew: true,
325+
},
326+
"consistency_check": {
327+
Type: schema.TypeString,
328+
Optional: true,
329+
ForceNew: true,
330+
},
331+
"enable_requester_pays": {
332+
Type: schema.TypeBool,
333+
Optional: true,
334+
ForceNew: true,
335+
},
336+
"object_overwrite_mode": {
337+
Type: schema.TypeString,
338+
Optional: true,
339+
ForceNew: true,
340+
},
296341
"name": {
297342
Type: schema.TypeString,
298343
Computed: true,
@@ -319,12 +364,14 @@ func buildSrcNodeOpts(rawSrcNode []interface{}) map[string]interface{} {
319364
"security_token": utils.ValueIgnoreEmpty(srcNode["security_token"]),
320365
"app_id": utils.ValueIgnoreEmpty(srcNode["app_id"]),
321366
"bucket": utils.ValueIgnoreEmpty(srcNode["bucket"]),
367+
"json_auth_file": utils.ValueIgnoreEmpty(srcNode["json_auth_file"]),
322368
}
323369

324370
if srcNode["list_file_bucket"].(string) != "" {
325371
srcNodeOpts["list_file"] = map[string]interface{}{
326372
"obs_bucket": srcNode["list_file_bucket"],
327373
"list_file_key": srcNode["list_file_key"],
374+
"list_file_num": utils.ValueIgnoreEmpty(srcNode["list_file_num"]),
328375
}
329376
}
330377

@@ -464,6 +511,12 @@ func buildcreateTaskBodyParams(d *schema.ResourceData, cfg *config.Config) (map[
464511
"enable_restore": d.Get("enable_restore"),
465512
"enable_failed_object_recording": d.Get("enable_failed_object_recording"),
466513
"source_cdn": buildSourceCdnOpts(d.Get("source_cdn").([]interface{})),
514+
"enable_metadata_migration": d.Get("enable_metadata_migration").(bool),
515+
"enable_requester_pays": d.Get("enable_requester_pays").(bool),
516+
"task_priority": utils.ValueIgnoreEmpty(d.Get("task_priority").(string)),
517+
"consistency_check": utils.ValueIgnoreEmpty(d.Get("consistency_check").(string)),
518+
"object_overwrite_mode": utils.ValueIgnoreEmpty(d.Get("object_overwrite_mode").(string)),
519+
"dst_storage_policy": utils.ValueIgnoreEmpty(d.Get("dst_storage_policy").(string)),
467520
}
468521

469522
dstNodeOpts, err := buildDstNodeOpts(cfg, d.Get("destination_object").([]interface{}))

huaweicloud/services/oms/resource_huaweicloud_oms_migration_task_group.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@ func ResourceMigrationTaskGroup() *schema.Resource {
268268
},
269269
},
270270
},
271+
"enable_metadata_migration": {
272+
Type: schema.TypeBool,
273+
Optional: true,
274+
ForceNew: true,
275+
},
276+
"dst_storage_policy": {
277+
Type: schema.TypeString,
278+
Optional: true,
279+
ForceNew: true,
280+
},
271281
"status": {
272282
Type: schema.TypeInt,
273283
Computed: true,
@@ -412,6 +422,8 @@ func buildTaskGroupCreateOpts(conf *config.Config, d *schema.ResourceData) (map[
412422
"enable_requester_pays": utils.ValueIgnoreEmpty(d.Get("enable_requester_pays")),
413423
"object_overwrite_mode": utils.ValueIgnoreEmpty(d.Get("object_overwrite_mode")),
414424
"consistency_check": utils.ValueIgnoreEmpty(d.Get("consistency_check")),
425+
"enable_metadata_migration": d.Get("enable_metadata_migration").(bool),
426+
"dst_storage_policy": utils.ValueIgnoreEmpty(d.Get("dst_storage_policy").(string)),
415427
}
416428

417429
return createOpts, nil

0 commit comments

Comments
 (0)