fix: linting cleanup
This commit is contained in:
parent
6b513231b3
commit
468841db57
5 changed files with 14 additions and 24 deletions
|
|
@ -226,12 +226,6 @@ func (r *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
//if instanceResp != nil && instanceResp.Status != nil && *instanceResp.Status == wait.InstanceStateDeleted {
|
||||
// resp.State.RemoveResource(ctx)
|
||||
// core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", "Instance was deleted successfully")
|
||||
// return
|
||||
//}
|
||||
|
||||
var flavor = &flavorModel{}
|
||||
if instanceResp != nil && instanceResp.FlavorId != nil {
|
||||
flavor.Id = types.StringValue(*instanceResp.FlavorId)
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ func loadFlavorId(ctx context.Context, client postgresflexClient, model *Model,
|
|||
}
|
||||
if foundFlavorCount > 1 {
|
||||
return fmt.Errorf(
|
||||
"number of flavors returned: %d\nmultiple flavors found: %d flavors\n %s\n",
|
||||
"number of flavors returned: %d\nmultiple flavors found: %d flavors\n %s",
|
||||
len(flavorList),
|
||||
foundFlavorCount,
|
||||
strings.Join(foundFlavors, "\n "),
|
||||
|
|
@ -409,9 +409,7 @@ func getAllFlavors(ctx context.Context, client postgresflexClient, projectId, re
|
|||
}
|
||||
pagination := res.GetPagination()
|
||||
flavors := res.GetFlavors()
|
||||
for _, flavor := range flavors {
|
||||
flavorList = append(flavorList, flavor)
|
||||
}
|
||||
flavorList = append(flavorList, flavors...)
|
||||
|
||||
if *pagination.TotalRows < int64(len(flavorList)) {
|
||||
return nil, fmt.Errorf("total rows is smaller than current accumulated list - that should not happen")
|
||||
|
|
|
|||
|
|
@ -448,7 +448,12 @@ func testFlavorToResponseFlavor(f testFlavor) postgresflex.ListFlavors {
|
|||
}
|
||||
}
|
||||
|
||||
func (c postgresFlexClientMocked) GetFlavorsRequestExecute(_ context.Context, _, _ string, page *int64, size *int64, _ *postgresflex.FlavorSort) (*postgresflex.GetFlavorsResponse, error) {
|
||||
func (c postgresFlexClientMocked) GetFlavorsRequestExecute(
|
||||
_ context.Context,
|
||||
_, _ string,
|
||||
page, size *int64,
|
||||
_ *postgresflex.FlavorSort,
|
||||
) (*postgresflex.GetFlavorsResponse, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("get flavors failed")
|
||||
}
|
||||
|
|
@ -457,16 +462,13 @@ func (c postgresFlexClientMocked) GetFlavorsRequestExecute(_ context.Context, _,
|
|||
var resFlavors []postgresflex.ListFlavors
|
||||
|
||||
myList := responseList[c.firstItem : c.lastItem+1]
|
||||
// fmt.Printf("list length: %d\n", len(myList))
|
||||
|
||||
firstItem := *page**size - *size
|
||||
// fmt.Printf("firstItem: %d\n", firstItem)
|
||||
if firstItem > int64(len(myList)) {
|
||||
firstItem = int64(len(myList))
|
||||
}
|
||||
|
||||
lastItem := firstItem + *size
|
||||
// fmt.Printf("lastItem: %d\n", lastItem)
|
||||
if lastItem > int64(len(myList)) {
|
||||
lastItem = int64(len(myList))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -616,11 +616,6 @@ func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, r
|
|||
|
||||
ctx = core.LogResponse(ctx)
|
||||
|
||||
//if instanceResp != nil && instanceResp.Status != nil && *instanceResp.Status == wait.InstanceStateDeleted {
|
||||
// resp.State.RemoveResource(ctx)
|
||||
// return
|
||||
//}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(ctx, instanceResp, &model, flavor, storage, encryption, network, region)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue