Skip to content

Commit

Permalink
Update to client version v2.2.38
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 committed Jun 17, 2022
1 parent ad7e293 commit b7d4618
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/datastax/terraform-provider-astra/v2
go 1.16

require (
github.com/datastax/astra-client-go/v2 v2.2.35
github.com/datastax/astra-client-go/v2 v2.2.38
github.com/google/uuid v1.3.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-retryablehttp v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/datastax/astra-client-go/v2 v2.2.35 h1:9Ue2sMoZPY3LJgx23H2OddKz/ldz3nmL2FvXRs5W2p4=
github.com/datastax/astra-client-go/v2 v2.2.35/go.mod h1:4sV7e/n7TFQ9IKv4cwtGC5r0ko6cKn3Dq2iUwLY+7nY=
github.com/datastax/astra-client-go/v2 v2.2.38 h1:jKuSlH2wP9IbQ4nhee1DgSgwmkUYRaJVIkV7dYlA6Pg=
github.com/datastax/astra-client-go/v2 v2.2.38/go.mod h1:4sV7e/n7TFQ9IKv4cwtGC5r0ko6cKn3Dq2iUwLY+7nY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_access_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func listAccessList(ctx context.Context, client *astra.ClientWithResponses, data
}

// If the database is terminated then the private links have been deleted.
if db.Status == astra.StatusEnumTERMINATING || db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATING || db.Status == astra.TERMINATED {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func listKeyspaces(ctx context.Context, client *astra.ClientWithResponses, datab
}

// If the database is terminated then the keyspaces have been deleted.
if db.Status == astra.StatusEnumTERMINATING || db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATING || db.Status == astra.TERMINATED {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_private_link_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func listPrivateLinkEndpoints(ctx context.Context, client *astra.ClientWithRespo
}

// If the database is terminated then the private links have been deleted.
if db.Status == astra.StatusEnumTERMINATING || db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATING || db.Status == astra.TERMINATED {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/provider/data_source_private_links.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func listPrivateLinks(ctx context.Context, client *astra.ClientWithResponses, da
}

// If the database is terminated then the private links have been deleted.
if db.Status == astra.StatusEnumTERMINATING || db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATING || db.Status == astra.TERMINATED {
return nil, nil
}

Expand Down
8 changes: 4 additions & 4 deletions internal/provider/resource_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func resourceDatabaseRead(ctx context.Context, resourceData *schema.ResourceData
}

// If the database is TERMINATING or TERMINATED then remove it from the state
if db.Status == astra.StatusEnumTERMINATING || db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATING || db.Status == astra.TERMINATED {
resourceData.SetId("")
return nil
}
Expand Down Expand Up @@ -309,7 +309,7 @@ func resourceDatabaseDelete(ctx context.Context, resourceData *schema.ResourceDa

// Return when the database is in a TERMINATED state
db := res.JSON200
if db.Status == astra.StatusEnumTERMINATED {
if db.Status == astra.TERMINATED {
return nil
}

Expand Down Expand Up @@ -462,10 +462,10 @@ func waitForDatabaseAndUpdateResource(ctx context.Context, resourceData *schema.
// Success fetching database
db := res.JSON200
switch db.Status {
case astra.StatusEnumERROR, astra.StatusEnumTERMINATED, astra.StatusEnumTERMINATING:
case astra.ERROR, astra.TERMINATED, astra.TERMINATING:
// If the database reached a terminal state it will never become active
return resource.NonRetryableError(fmt.Errorf("database failed to reach active status: status=%s", db.Status))
case astra.StatusEnumACTIVE:
case astra.ACTIVE:
if err := setDatabaseResourceData(resourceData, db); err != nil {
return resource.NonRetryableError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_keyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func resourceKeyspaceCreate(ctx context.Context, d *schema.ResourceData, meta in
// Success fetching database
db := res.JSON200
switch db.Status {
case astra.StatusEnumERROR, astra.StatusEnumTERMINATED, astra.StatusEnumTERMINATING:
case astra.ERROR, astra.TERMINATED, astra.TERMINATING:
// If the database reached a terminal state it will never become active
return resource.NonRetryableError(fmt.Errorf("database failed to reach active status: status=%s", db.Status))
case astra.StatusEnumACTIVE:
case astra.ACTIVE:
keyspaceMutex.Lock()
resp, err := client.AddKeyspaceWithResponse(ctx, astra.DatabaseIdParam(databaseID), astra.KeyspaceNameParam(keyspaceName))
keyspaceMutex.Unlock()
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/resource_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ func resourceTableCreate(ctx context.Context, d *schema.ResourceData, meta inter
// Success fetching database
db := res.JSON200
switch db.Status {
case astra.StatusEnumERROR, astra.StatusEnumTERMINATED, astra.StatusEnumTERMINATING:
case astra.ERROR, astra.TERMINATED, astra.TERMINATING:
// If the database reached a terminal state it will never become active
return resource.NonRetryableError(fmt.Errorf("database failed to reach active status: status=%s", db.Status))
case astra.StatusEnumACTIVE:
case astra.ACTIVE:
resp, err := restClient.CreateTable(ctx, keyspaceName, &tableParams, createJSON)
if err != nil {
b, _:= io.ReadAll(resp.Body)
Expand Down

0 comments on commit b7d4618

Please sign in to comment.