-
Notifications
You must be signed in to change notification settings - Fork 193
feat(cbh): add postPaid mode to create instance #8004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
f481907 to
8731cfa
Compare
8731cfa to
41f0247
Compare
| Changing this parameter will create a new resource. | ||
|
|
||
| * `period_unit` - (Required, String, ForceNew) Specifies the charging period unit of the instance. | ||
| * `period_unit` - (Optional, String, ForceNew) Specifies the charging period unit of the instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the Required description.
| "month", "year", | ||
| }, false), | ||
| Description: `Specifies the charging period unit of the instance.`, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The current network environment only supports prepaid CBH. However, the HCSO environment supports CBH with prepaid and postpaid. Hiding postpaid capabilities as internal features.
"period_unit": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"month", "year",
}, false),
Description: utils.SchemaDesc("Specifies the charging period unit of the instance.", utils.SchemaDescInput{Required: true}),
},
| }, false), | ||
| Description: `Specifies the charging period unit of the instance.`, | ||
| }, | ||
| "period": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same to field period_unit.
| if err != nil { | ||
| return diag.Errorf("error creating CBH client: %s", err) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is poorly readable and is recommended for optimization.
respBody, err := createCBHInstance(client, d, cfg)
if err != nil {
return diag.FromErr(err)
}
var instanceID string
if d.Get("charging_mode").(string) == "prePaid" {
instanceID, err := waitingPostpaidCBHComplete()
} else {
instanceID, err := utils.PathSearch("instance_id", respBody, "").(string)
}
d.SetId(instanceID)
if err := waitingForCBHInstanceActive(ctx, client, d, d.Timeout(schema.TimeoutCreate)); err != nil {
return diag.Errorf("error waiting for CBH instance (%s) creation to active: %s", d.Id(), err)
}
|
No documentation for postpaid CBH was found on the official website, and there is a lack of logical support. |
What this PR does / why we need it:
add postPaid mode to create instance
Which issue this PR fixes:
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close that issue when PR gets merged)fixes #xxx
Special notes for your reviewer:
Release note:
PR Checklist
Documentation updated.
Schema updated.
CheckDeleted.
a. During query operation (Read Context)
aa. Resource not found
>>>>>> Paste the screenshot here <<<<<<
b. During delete/disassociate/unbind operation (Delete Context)
ba. Resource not found
>>>>>> Paste the screenshot here <<<<<<