Skip to content

Commit

Permalink
adjust the uint64 to int64 since the mps sdk updating the type
Browse files Browse the repository at this point in the history
  • Loading branch information
lyu571 committed Sep 28, 2023
1 parent 5677909 commit 34808ad
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 88 deletions.
3 changes: 3 additions & 0 deletions .changelog/2163.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
tencentcloud_mps_withdraws_watermark_operation
```
2 changes: 2 additions & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,7 @@ Media Processing Service(MPS)
tencentcloud_mps_ai_analysis_template
tencentcloud_mps_adaptive_dynamic_streaming_template
tencentcloud_mps_person_sample
tencentcloud_mps_withdraws_watermark_operation
Cloud HDFS(CHDFS)
Data Source
Expand Down Expand Up @@ -3029,6 +3030,7 @@ func Provider() *schema.Provider {
"tencentcloud_mps_ai_analysis_template": resourceTencentCloudMpsAiAnalysisTemplate(),
"tencentcloud_mps_adaptive_dynamic_streaming_template": resourceTencentCloudMpsAdaptiveDynamicStreamingTemplate(),
"tencentcloud_mps_person_sample": resourceTencentCloudMpsPersonSample(),
"tencentcloud_mps_withdraws_watermark_operation": resourceTencentCloudMpsWithdrawsWatermarkOperation(),
"tencentcloud_cbs_disk_backup": resourceTencentCloudCbsDiskBackup(),
"tencentcloud_cbs_snapshot_share_permission": resourceTencentCloudCbsSnapshotSharePermission(),
"tencentcloud_cbs_disk_backup_rollback_operation": resourceTencentCloudCbsDiskBackupRollbackOperation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ func resourceTencentCloudMpsAdaptiveDynamicStreamingTemplateCreate(d *schema.Res
videoTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := videoMap["fps"]; ok {
videoTemplateInfo.Fps = helper.IntUint64(v.(int))
videoTemplateInfo.Fps = helper.IntInt64(v.(int))
}
if v, ok := videoMap["bitrate"]; ok {
videoTemplateInfo.Bitrate = helper.IntUint64(v.(int))
videoTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := videoMap["resolution_adaptive"]; ok {
videoTemplateInfo.ResolutionAdaptive = helper.String(v.(string))
Expand Down Expand Up @@ -285,7 +285,7 @@ func resourceTencentCloudMpsAdaptiveDynamicStreamingTemplateCreate(d *schema.Res
audioTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := audioMap["bitrate"]; ok {
audioTemplateInfo.Bitrate = helper.IntUint64(v.(int))
audioTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := audioMap["sample_rate"]; ok {
audioTemplateInfo.SampleRate = helper.IntUint64(v.(int))
Expand Down Expand Up @@ -511,10 +511,10 @@ func resourceTencentCloudMpsAdaptiveDynamicStreamingTemplateUpdate(d *schema.Res
videoTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := videoMap["fps"]; ok {
videoTemplateInfo.Fps = helper.IntUint64(v.(int))
videoTemplateInfo.Fps = helper.IntInt64(v.(int))
}
if v, ok := videoMap["bitrate"]; ok {
videoTemplateInfo.Bitrate = helper.IntUint64(v.(int))
videoTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := videoMap["resolution_adaptive"]; ok {
videoTemplateInfo.ResolutionAdaptive = helper.String(v.(string))
Expand Down Expand Up @@ -542,7 +542,7 @@ func resourceTencentCloudMpsAdaptiveDynamicStreamingTemplateUpdate(d *schema.Res
audioTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := audioMap["bitrate"]; ok {
audioTemplateInfo.Bitrate = helper.IntUint64(v.(int))
audioTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := audioMap["sample_rate"]; ok {
audioTemplateInfo.SampleRate = helper.IntUint64(v.(int))
Expand Down
16 changes: 8 additions & 8 deletions tencentcloud/resource_tc_mps_transcode_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,10 @@ func resourceTencentCloudMpsTranscodeTemplateCreate(d *schema.ResourceData, meta
videoTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := dMap["fps"]; ok {
videoTemplateInfo.Fps = helper.IntUint64(v.(int))
videoTemplateInfo.Fps = helper.IntInt64(v.(int))
}
if v, ok := dMap["bitrate"]; ok {
videoTemplateInfo.Bitrate = helper.IntUint64(v.(int))
videoTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := dMap["resolution_adaptive"]; ok {
videoTemplateInfo.ResolutionAdaptive = helper.String(v.(string))
Expand Down Expand Up @@ -517,7 +517,7 @@ func resourceTencentCloudMpsTranscodeTemplateCreate(d *schema.ResourceData, meta
audioTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := dMap["bitrate"]; ok {
audioTemplateInfo.Bitrate = helper.IntUint64(v.(int))
audioTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := dMap["sample_rate"]; ok {
audioTemplateInfo.SampleRate = helper.IntUint64(v.(int))
Expand All @@ -534,7 +534,7 @@ func resourceTencentCloudMpsTranscodeTemplateCreate(d *schema.ResourceData, meta
tEHDConfig.Type = helper.String(v.(string))
}
if v, ok := dMap["max_video_bitrate"]; ok {
tEHDConfig.MaxVideoBitrate = helper.IntUint64(v.(int))
tEHDConfig.MaxVideoBitrate = helper.IntInt64(v.(int))
}
request.TEHDConfig = &tEHDConfig
}
Expand Down Expand Up @@ -1025,10 +1025,10 @@ func resourceTencentCloudMpsTranscodeTemplateUpdate(d *schema.ResourceData, meta
videoTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := dMap["fps"]; ok {
videoTemplateInfo.Fps = helper.IntUint64(v.(int))
videoTemplateInfo.Fps = helper.IntInt64(v.(int))
}
if v, ok := dMap["bitrate"]; ok {
videoTemplateInfo.Bitrate = helper.IntUint64(v.(int))
videoTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := dMap["resolution_adaptive"]; ok {
videoTemplateInfo.ResolutionAdaptive = helper.String(v.(string))
Expand Down Expand Up @@ -1059,7 +1059,7 @@ func resourceTencentCloudMpsTranscodeTemplateUpdate(d *schema.ResourceData, meta
audioTemplateInfo.Codec = helper.String(v.(string))
}
if v, ok := dMap["bitrate"]; ok {
audioTemplateInfo.Bitrate = helper.IntUint64(v.(int))
audioTemplateInfo.Bitrate = helper.IntInt64(v.(int))
}
if v, ok := dMap["sample_rate"]; ok {
audioTemplateInfo.SampleRate = helper.IntUint64(v.(int))
Expand All @@ -1078,7 +1078,7 @@ func resourceTencentCloudMpsTranscodeTemplateUpdate(d *schema.ResourceData, meta
tEHDConfig.Type = helper.String(v.(string))
}
if v, ok := dMap["max_video_bitrate"]; ok {
tEHDConfig.MaxVideoBitrate = helper.IntUint64(v.(int))
tEHDConfig.MaxVideoBitrate = helper.IntInt64(v.(int))
}
request.TEHDConfig = &tEHDConfig
}
Expand Down
70 changes: 24 additions & 46 deletions tencentcloud/resource_tc_mps_withdraws_watermark_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,35 @@ Provides a resource to create a mps withdraws_watermark_operation
Example Usage
```hcl
resource "tencentcloud_mps_withdraws_watermark_operation" "withdraws_watermark_operation" {
input_info {
type = ""
cos_input_info {
bucket = ""
region = ""
object = ""
}
url_input_info {
url = ""
}
s3_input_info {
s3_bucket = ""
s3_region = ""
s3_object = ""
s3_secret_id = ""
s3_secret_key = ""
}
Withdraw the watermark from COS
}
task_notify_config {
cmq_model = ""
cmq_region = ""
topic_name = ""
queue_name = ""
notify_mode = ""
notify_type = ""
notify_url = ""
aws_sqs {
sqs_region = ""
sqs_queue_name = ""
s3_secret_id = ""
s3_secret_key = ""
}
```hcl
resource "tencentcloud_cos_bucket" "example" {
bucket = "tf-test-mps-wm-${local.app_id}"
acl = "public-read"
}
}
session_context = ""
resource "tencentcloud_cos_bucket_object" "example" {
bucket = tencentcloud_cos_bucket.example.bucket
key = "/test-file/test.mov"
source = "/Users/luoyin/Downloads/file_example_MOV_480_700kB.mov"
}
```
Import
mps withdraws_watermark_operation can be imported using the id, e.g.
resource "tencentcloud_mps_withdraws_watermark_operation" "operation" {
input_info {
type = "COS"
cos_input_info {
bucket = tencentcloud_cos_bucket_object.example.bucket
region = "%s"
object = tencentcloud_cos_bucket_object.example.key
}
}
session_context = "this is a example session context"
}
```
terraform import tencentcloud_mps_withdraws_watermark_operation.withdraws_watermark_operation withdraws_watermark_operation_id
```
*/
package tencentcloud

Expand All @@ -68,9 +49,6 @@ func resourceTencentCloudMpsWithdrawsWatermarkOperation() *schema.Resource {
Create: resourceTencentCloudMpsWithdrawsWatermarkOperationCreate,
Read: resourceTencentCloudMpsWithdrawsWatermarkOperationRead,
Delete: resourceTencentCloudMpsWithdrawsWatermarkOperationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"input_info": {
Required: true,
Expand All @@ -83,7 +61,7 @@ func resourceTencentCloudMpsWithdrawsWatermarkOperation() *schema.Resource {
"type": {
Type: schema.TypeString,
Required: true,
Description: "The input type. Valid values:<li>`COS`: A COS bucket address.</li><li> `URL`: A URL.</li><li> `AWS-S3`: An AWS S3 bucket address. Currently, this type is only supported for transcoding tasks.</li>.",
Description: "The input type. Valid values: `COS`: A COS bucket address. `URL`: A URL. `AWS-S3`: An AWS S3 bucket address. Currently, this type is only supported for transcoding tasks..",
},
"cos_input_info": {
Type: schema.TypeList,
Expand Down Expand Up @@ -200,7 +178,7 @@ func resourceTencentCloudMpsWithdrawsWatermarkOperation() *schema.Resource {
"notify_type": {
Type: schema.TypeString,
Optional: true,
Description: "The notification type. Valid values: <li>`CMQ`: This value is no longer used. Please use `TDMQ-CMQ` instead.</li> <li>`TDMQ-CMQ`: Message queue</li> <li>`URL`: If `NotifyType` is set to `URL`, HTTP callbacks are sent to the URL specified by `NotifyUrl`. HTTP and JSON are used for the callbacks. The packet contains the response parameters of the `ParseNotification` API.</li> <li>`SCF`: This notification type is not recommended. You need to configure it in the SCF console.</li> <li>`AWS-SQS`: AWS queue. This type is only supported for AWS tasks, and the queue must be in the same region as the AWS bucket.</li> <font color=red>Note: If you do not pass this parameter or pass in an empty string, `CMQ` will be used. To use a different notification type, specify this parameter accordingly.</font>.",
Description: "The notification type. Valid values: `CMQ`: This value is no longer used. Please use `TDMQ-CMQ` instead. `TDMQ-CMQ`: Message queue `URL`: If `NotifyType` is set to `URL`, HTTP callbacks are sent to the URL specified by `NotifyUrl`. HTTP and JSON are used for the callbacks. The packet contains the response parameters of the `ParseNotification` API. `SCF`: This notification type is not recommended. You need to configure it in the SCF console. `AWS-SQS`: AWS queue. This type is only supported for AWS tasks, and the queue must be in the same region as the AWS bucket. Note: If you do not pass this parameter or pass in an empty string, `CMQ` will be used. To use a different notification type, specify this parameter accordingly.",
},
"notify_url": {
Type: schema.TypeString,
Expand Down
18 changes: 6 additions & 12 deletions tencentcloud/resource_tc_mps_withdraws_watermark_operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tencentcloud

import (
"fmt"
"os"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -17,23 +16,18 @@ func TestAccTencentCloudMpsWithdrawsWatermarkOperationResource_basic(t *testing.
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(testAccMpsWithdrawsWatermarkOperation, os.Getenv(PROVIDER_REGION)),
Config: fmt.Sprintf(testAccMpsWithdrawsWatermarkOperation, defaultRegion),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("tencentcloud_mps_withdraws_watermark_operation.operation", "id"),
resource.TestCheckResourceAttrSet("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.#"),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.type", "cos"),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.type", "COS"),
resource.TestCheckResourceAttrSet("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.cos_input_info.#"),
resource.TestCheckResourceAttrSet("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.cos_input_info.0.bucket"),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.cos_input_info.0.region", os.Getenv(PROVIDER_REGION)),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.cos_input_info.0.region", defaultRegion),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "input_info.0.cos_input_info.0.object", "/mps-test/test.mov"),
resource.TestCheckResourceAttr("tencentcloud_mps_withdraws_watermark_operation.operation", "session_context", "this is a example session context"),
),
},
{
ResourceName: "tencentcloud_mps_withdraws_watermark_operation.operation",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand All @@ -57,11 +51,11 @@ data "tencentcloud_cos_bucket_object" "object" {
resource "tencentcloud_mps_withdraws_watermark_operation" "operation" {
input_info {
type = "cos"
type = "COS"
cos_input_info {
bucket = data.tencentcloud_cos_bucket_object.object.0.bucket
bucket = data.tencentcloud_cos_bucket_object.object.bucket
region = "%s"
object = data.tencentcloud_cos_bucket_object.object.0.key
object = data.tencentcloud_cos_bucket_object.object.key
}
}
// task_notify_config {
Expand Down
Loading

0 comments on commit 34808ad

Please sign in to comment.