Skip to content

Commit

Permalink
Merge branch 'feat/tos_handler' into 'feat/acc_nat'
Browse files Browse the repository at this point in the history
feat: update tos handler

See merge request iaasng/terraform-provider-volcengine!339
  • Loading branch information
zpp12354321 committed Aug 15, 2023
2 parents 325475c + 2f2940c commit c894173
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions common/common_volcengine_bypass_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (u *BypassSvc) DoBypassSvcCall(info BypassSvcInfo, input *map[string]interf
if info.ContentPath != "" && (op.HTTPMethod == "PUT" || op.HTTPMethod == "POST") {
content, _ = os.Open(info.ContentPath)
req.Body = content
req.ResetBody()
req.HTTPRequest.Header.Set("Content-Length", strconv.FormatInt(u.tryResolveLength(content), 10))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func resourceVolcengineTosBucketPolicyCreate(d *schema.ResourceData, meta interf
tosBucketService := NewTosBucketPolicyService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Create(tosBucketService, d, ResourceVolcengineTosBucketPolicy())
if err != nil {
return fmt.Errorf("error on creating tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on creating tos bucket policy %q, %s", d.Id(), err)
}
return resourceVolcengineTosBucketPolicyRead(d, meta)
}
Expand All @@ -128,7 +128,7 @@ func resourceVolcengineTosBucketPolicyRead(d *schema.ResourceData, meta interfac
tosBucketService := NewTosBucketPolicyService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Read(tosBucketService, d, ResourceVolcengineTosBucketPolicy())
if err != nil {
return fmt.Errorf("error on reading tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on reading tos bucket policy %q, %s", d.Id(), err)
}
return err
}
Expand All @@ -137,7 +137,7 @@ func resourceVolcengineTosBucketPolicyUpdate(d *schema.ResourceData, meta interf
tosBucketService := NewTosBucketPolicyService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Update(tosBucketService, d, ResourceVolcengineTosBucketPolicy())
if err != nil {
return fmt.Errorf("error on updating tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on updating tos bucket policy %q, %s", d.Id(), err)
}
return resourceVolcengineTosBucketPolicyRead(d, meta)
}
Expand All @@ -146,7 +146,7 @@ func resourceVolcengineTosBucketPolicyDelete(d *schema.ResourceData, meta interf
tosBucketService := NewTosBucketPolicyService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Delete(tosBucketService, d, ResourceVolcengineTosBucketPolicy())
if err != nil {
return fmt.Errorf("error on deleting tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on deleting tos bucket policy %q, %s", d.Id(), err)
}
return err
}
8 changes: 4 additions & 4 deletions volcengine/tos/object/resource_volcengine_tos_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func resourceVolcengineTosObjectCreate(d *schema.ResourceData, meta interface{})
tosBucketService := NewTosObjectService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Create(tosBucketService, d, ResourceVolcengineTosObject())
if err != nil {
return fmt.Errorf("error on creating tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on creating tos object %q, %s", d.Id(), err)
}
return resourceVolcengineTosObjectRead(d, meta)
}
Expand All @@ -180,7 +180,7 @@ func resourceVolcengineTosObjectRead(d *schema.ResourceData, meta interface{}) (
tosBucketService := NewTosObjectService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Read(tosBucketService, d, ResourceVolcengineTosObject())
if err != nil {
return fmt.Errorf("error on reading tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on reading tos object %q, %s", d.Id(), err)
}
return err
}
Expand All @@ -189,7 +189,7 @@ func resourceVolcengineTosObjectUpdate(d *schema.ResourceData, meta interface{})
tosBucketService := NewTosObjectService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Update(tosBucketService, d, ResourceVolcengineTosObject())
if err != nil {
return fmt.Errorf("error on updating tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on updating tos object %q, %s", d.Id(), err)
}
return resourceVolcengineTosObjectRead(d, meta)
}
Expand All @@ -198,7 +198,7 @@ func resourceVolcengineTosObjectDelete(d *schema.ResourceData, meta interface{})
tosBucketService := NewTosObjectService(meta.(*ve.SdkClient))
err = ve.DefaultDispatcher().Delete(tosBucketService, d, ResourceVolcengineTosObject())
if err != nil {
return fmt.Errorf("error on deleting tos bucket %q, %s", d.Id(), err)
return fmt.Errorf("error on deleting tos object %q, %s", d.Id(), err)
}
return err
}

0 comments on commit c894173

Please sign in to comment.