Skip to content

Commit

Permalink
feat: opt mysql database code
Browse files Browse the repository at this point in the history
  • Loading branch information
zzmher committed Jan 15, 2024
1 parent bb87d7a commit 6a3bc13
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ func (s *VolcengineRdsMysqlDatabaseService) CreateResource(resourceData *schema.
Action: "CreateDatabase",
ContentType: volc.ContentTypeJson,
ConvertMode: volc.RequestConvertAll,
LockId: func(d *schema.ResourceData) string {
return d.Get("instance_id").(string)
},
Convert: map[string]volc.RequestConvert{
"database_privileges": {
TargetField: "DatabasePrivileges",
ConvertType: volc.ConvertJsonObjectArray,
"db_name": {
TargetField: "DBName",
},
},
ExecuteCall: func(d *schema.ResourceData, client *volc.SdkClient, call volc.SdkCall) (*map[string]interface{}, error) {
Expand Down Expand Up @@ -160,6 +162,9 @@ func (s *VolcengineRdsMysqlDatabaseService) RemoveResource(resourceData *schema.
Action: "DeleteDatabase",
ContentType: volc.ContentTypeJson,
ConvertMode: volc.RequestConvertIgnore,
LockId: func(d *schema.ResourceData) string {
return d.Get("instance_id").(string)
},
BeforeCall: func(d *schema.ResourceData, client *volc.SdkClient, call volc.SdkCall) (bool, error) {
databaseId := d.Id()
ids := strings.Split(databaseId, ":")
Expand Down

0 comments on commit 6a3bc13

Please sign in to comment.