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/v1.8.0 beta 2 #533

Merged
merged 18 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
## 1.8.0-beta-2 (Jan 20, 2023)
[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/v1.8.0-beta.1...v1.8.0-beta.2)

**New Feature:**

- Feat/1.8.0-beta.2 Release with Nutanix Database Service based resource and datasources [\#533] (https://github.com/nutanix/terraform-provider-nutanix/pull/533)

New Resources:
- nutanix_ndb_profile
- nutanix_ndb_sla
- nutanix_ndb_database_scale
- nutanix_ndb_database_restore
- nutanix_ndb_database_snapshot
- nutanix_ndb_register_database
- nutanix_ndb_clone
- nutanix_ndb_log_catchups
- nutanix_ndb_authorize_dbservers
- nutanix_ndb_software_version_profile
- nutanix_ndb_linked_databases

New Data Sources:
- nutanix_ndb_snapshot
- nutanix_ndb_snapshots
- nutanix_ndb_time_machine
- nutanix_ndb_time_machines
- nutanix_ndb_tms_capability
- nutanix_ndb_clone
- nutanix_ndb_clones


**Implemented enhancements:**
- Support for HA instance in nutanix_ndb_database resource. [\#518](https://github.com/nutanix/terraform-provider-nutanix/pull/518)
- Improving the error when server is unreachable. [\#530](https://github.com/nutanix/terraform-provider-nutanix/pull/530)
- Fetching of database based on database_type filter [\#513](https://github.com/nutanix/terraform-provider-nutanix/pull/513)
- Support of Tags and Maintainence Window in provisioning [\#528](https://github.com/nutanix/terraform-provider-nutanix/pull/528)


## 1.8.0-beta.1 (Oct 12, 2022)

[Full Changelog](https://github.com/nutanix/terraform-provider-nutanix/compare/v1.7.1...v1.8.0-beta.1)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Terraform provider plugin to integrate with Nutanix Enterprise Cloud

NOTE: The latest version of the Nutanix provider is [v1.8.0-beta.1](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.8.0-beta.1)
NOTE: The latest version of the Nutanix provider is [v1.8.0-beta.2](https://github.com/nutanix/terraform-provider-nutanix/releases/tag/v1.8.0-beta.2)

Modules based on Terraform Nutanix Provider can be found here : [Modules](https://github.com/nutanix/terraform-provider-nutanix/tree/master/modules)
## Build, Quality Status
Expand Down Expand Up @@ -75,7 +75,9 @@ Foundation Central based modules and examples : Foundation based modules & examp
## Nutanix Database Service
> For the 1.8.0-beta.1 release of the provider, it will have N-1 compatibility with the Nutanix database service. This release was tested with v2.4 and v2.4.1 versions.

Note: For 1.8.0-beta.1 release, only postgress database type is qualified and officially supported.
> For the 1.8.0-beta.2 release of the provider, it will have N-2 compatibilty with the Nutanix Database Service. This release was tested with v2.5.1.1 , v2.5.0.2 and v2.4.1

Note: For 1.8.0-beta.2 release, only postgress database type is qualified and officially supported.

Checkout example : https://github.com/nutanix/terraform-provider-nutanix/blob/master/examples/ndb/database_instance

Expand Down
10 changes: 5 additions & 5 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,11 @@ func CheckResponse(r *http.Response) error {
// Nutanix returns non-json response with code 401 when
// invalid credentials are used
if c == http.StatusUnauthorized {
return fmt.Errorf("invalid Nutanix Credentials")
return fmt.Errorf("invalid auth Credentials")
}

if c == http.StatusBadRequest {
return fmt.Errorf("bad Request")
}

buf, err := ioutil.ReadAll(r.Body)
Expand All @@ -574,7 +578,6 @@ func CheckResponse(r *http.Response) error {
if err != nil {
return fmt.Errorf("unmarshalling error response %s for response body %s", err, string(buf))
}
log.Print("[DEBUG] after json.Unmarshal")

errRes := &ErrorResponse{}
if status, ok := res["status"]; ok {
Expand All @@ -590,11 +593,9 @@ func CheckResponse(r *http.Response) error {
return nil
}

log.Print("[DEBUG] after bunch of switch cases")
if err != nil {
return err
}
log.Print("[DEBUG] first nil check")

// karbon error check
if messageInfo, ok := res["message_info"]; ok {
Expand All @@ -610,7 +611,6 @@ func CheckResponse(r *http.Response) error {
return nil
}

log.Print("[DEBUG] after errRes.State")
pretty, _ := json.MarshalIndent(errRes, "", " ")
return fmt.Errorf("error: %s", string(pretty))
}
Expand Down
12 changes: 6 additions & 6 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestGetResponse(t *testing.T) {
StatusCode: http.StatusBadRequest,
Body: ioutil.NopCloser(strings.NewReader(
`{"api_version": "3.1", "code": 400, "kind": "error", "message_list":
[{"message": "This field may not be blank."}], "state": "ERROR"}`)),
[{"message": "bad Request"}], "state": "ERROR"}`)),
}

err := CheckResponse(res)
Expand All @@ -292,8 +292,8 @@ func TestGetResponse(t *testing.T) {
t.Fatal("Expected error response.")
}

if !strings.Contains(fmt.Sprint(err), "This field may not be blank.") {
t.Errorf("error = %#v, expected %#v", err, "This field may not be blank.")
if !strings.Contains(fmt.Sprint(err), "bad Request") {
t.Errorf("error = %#v, expected %#v", err, "bad Request")
}
}

Expand All @@ -303,16 +303,16 @@ func TestCheckResponse(t *testing.T) {
StatusCode: http.StatusBadRequest,
Body: ioutil.NopCloser(strings.NewReader(
`{"api_version": "3.1", "code": 400, "kind": "error", "message_list":
[{"message": "This field may not be blank."}], "state": "ERROR"}`)),
[{"message": "bad Request"}], "state": "ERROR"}`)),
}
err := CheckResponse(res)

if err == nil {
t.Fatalf("Expected error response.")
}

if !strings.Contains(fmt.Sprint(err), "This field may not be blank.") {
t.Errorf("error = %#v, expected %#v", err, "This field may not be blank.")
if !strings.Contains(fmt.Sprint(err), "bad Request") {
t.Errorf("error = %#v, expected %#v", err, "bad Request")
}
}

Expand Down
Loading