Skip to content
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

feat(CES): add resource CES dashboard widget #5447

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

profoundwu
Copy link
Contributor

@profoundwu profoundwu commented Aug 26, 2024

What this PR does / why we need it:
add resource CES dashboard widget
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:

1. add resource CES dashboard widget

PR Checklist

  • Tests added/passed.
 make testacc TEST="./huaweicloud/services/acceptance/ces" TESTARGS="-run TestAccDashboardWidget_basic"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud/services/acceptance/ces -v -run TestAccDashboardWidget_basic -timeout 360m -parallel 4
=== RUN   TestAccDashboardWidget_basic
=== PAUSE TestAccDashboardWidget_basic
=== CONT  TestAccDashboardWidget_basic
--- PASS: TestAccDashboardWidget_basic (553.92s)
PASS
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance/ces       553.973s

  • Documentation updated.

  • Schema updated.

  • CheckDeleted.

    • a. During query operation (Read Context)
      aa. Resource not found
      image

      ab. Related resources (parent resources) not found
      image

    • b. During delete/disassociate/unbind operation (Delete Context)
      ba. Resource not found
      image

      bb. Related resources (parent resources) not found
      image

Comment on lines 248 to 256
if _, ok := d.GetOk("unit"); ok {
updateWidgetPath := createWidgetClient.Endpoint + "v2/{project_id}/widgets/batch-update"
updateWidgetPath = strings.ReplaceAll(updateWidgetPath, "{project_id}", createWidgetClient.ProjectID)
updateWidgetOpt := golangsdk.RequestOpts{
KeepResponseBody: true,
MoreHeaders: map[string]string{"Content-Type": "application/json;charset=UTF-8"},
}
param := map[string]interface{}{
"widget_id": d.Id(),
"unit": d.Get("unit"),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this, no need to get again.

Suggested change
if _, ok := d.GetOk("unit"); ok {
updateWidgetPath := createWidgetClient.Endpoint + "v2/{project_id}/widgets/batch-update"
updateWidgetPath = strings.ReplaceAll(updateWidgetPath, "{project_id}", createWidgetClient.ProjectID)
updateWidgetOpt := golangsdk.RequestOpts{
KeepResponseBody: true,
MoreHeaders: map[string]string{"Content-Type": "application/json;charset=UTF-8"},
}
param := map[string]interface{}{
"widget_id": d.Id(),
"unit": d.Get("unit"),
}
if v, ok := d.GetOk("unit"); ok {
updateWidgetPath := createWidgetClient.Endpoint + "v2/{project_id}/widgets/batch-update"
updateWidgetPath = strings.ReplaceAll(updateWidgetPath, "{project_id}", createWidgetClient.ProjectID)
updateWidgetOpt := golangsdk.RequestOpts{
KeepResponseBody: true,
MoreHeaders: map[string]string{"Content-Type": "application/json;charset=UTF-8"},
}
param := map[string]interface{}{
"widget_id": d.Id(),
"unit": v,
}

@Jason-Zhang9309
Copy link
Collaborator

/approve

@github-ci-robot github-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2024
Copy link
Collaborator

@github-ci-robot github-ci-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has been approved by: @Jason-Zhang9309

/approve

@Jason-Zhang9309
Copy link
Collaborator

/lgtm

@github-ci-robot github-ci-robot added the LGTM /lgtm label Aug 26, 2024
@github-ci-robot github-ci-robot merged commit 1e1caa5 into huaweicloud:master Aug 26, 2024
14 checks passed
@profoundwu profoundwu deleted the ces_widget branch August 28, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. feature LGTM /lgtm size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants