Skip to content

Commit 91c37de

Browse files
committed
linter fix and review feedback.
1 parent 04eee74 commit 91c37de

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

internal/service/odb/cloud_vm_cluster.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package odb
66
import (
77
"context"
88
"errors"
9-
"regexp"
9+
"github.com/YakDriver/regexache"
1010
"strings"
1111
"time"
1212

@@ -74,7 +74,7 @@ func (r *resourceCloudVmCluster) Schema(ctx context.Context, req resource.Schema
7474
diskRedundancyType := fwtypes.StringEnumType[odbtypes.DiskRedundancy]()
7575
computeModelType := fwtypes.StringEnumType[odbtypes.ComputeModel]()
7676
giVersionValidator := []validator.String{
77-
stringvalidator.RegexMatches(regexp.MustCompile(MajorGiVersionPattern), "Gi version must be of the format 19.0.0.0"),
77+
stringvalidator.RegexMatches(regexache.MustCompile(MajorGiVersionPattern), "Gi version must be of the format 19.0.0.0"),
7878
}
7979
resp.Schema = schema.Schema{
8080
Attributes: map[string]schema.Attribute{
@@ -489,8 +489,8 @@ func (r *resourceCloudVmCluster) Create(ctx context.Context, req resource.Create
489489
plan.HostnamePrefix = types.StringValue(hostnamePrefix)
490490
plan.HostnamePrefixComputed = types.StringValue(*createdVmCluster.Hostname)
491491
//scan listener port not returned by API directly
492-
plan.ScanListenerPortTcp = types.Int32PointerValue(createdVmCluster.ListenerPort)
493-
plan.GiVersionComputed = types.StringPointerValue(createdVmCluster.GiVersion)
492+
plan.ScanListenerPortTcp = flex.Int32ToFramework(ctx, createdVmCluster.ListenerPort)
493+
plan.GiVersionComputed = flex.StringToFramework(ctx, createdVmCluster.GiVersion)
494494
giVersionMajor, err := getMajorGiVersion(createdVmCluster.GiVersion)
495495
if err != nil {
496496
resp.Diagnostics.AddError(
@@ -499,7 +499,7 @@ func (r *resourceCloudVmCluster) Create(ctx context.Context, req resource.Create
499499
)
500500
return
501501
}
502-
plan.GiVersion = types.StringPointerValue(giVersionMajor)
502+
plan.GiVersion = flex.StringToFramework(ctx, giVersionMajor)
503503
resp.Diagnostics.Append(flex.Flatten(ctx, createdVmCluster, &plan)...)
504504
if resp.Diagnostics.HasError() {
505505
return
@@ -532,8 +532,8 @@ func (r *resourceCloudVmCluster) Read(ctx context.Context, req resource.ReadRequ
532532
state.HostnamePrefix = types.StringValue(hostnamePrefix)
533533
state.HostnamePrefixComputed = types.StringValue(*out.Hostname)
534534
//scan listener port not returned by API directly
535-
state.ScanListenerPortTcp = types.Int32PointerValue(out.ListenerPort)
536-
state.GiVersionComputed = types.StringPointerValue(out.GiVersion)
535+
state.ScanListenerPortTcp = flex.Int32ToFramework(ctx, out.ListenerPort)
536+
state.GiVersionComputed = flex.StringToFramework(ctx, out.GiVersion)
537537
giVersionMajor, err := getMajorGiVersion(out.GiVersion)
538538
if err != nil {
539539
resp.Diagnostics.AddError(
@@ -542,7 +542,7 @@ func (r *resourceCloudVmCluster) Read(ctx context.Context, req resource.ReadRequ
542542
)
543543
return
544544
}
545-
state.GiVersion = types.StringPointerValue(giVersionMajor)
545+
state.GiVersion = flex.StringToFramework(ctx, giVersionMajor)
546546
resp.Diagnostics.Append(flex.Flatten(ctx, out, &state)...)
547547
if resp.Diagnostics.HasError() {
548548
return
@@ -656,7 +656,7 @@ func FindCloudVmClusterForResourceByID(ctx context.Context, conn *odb.Client, id
656656
func getMajorGiVersion(giVersionComputed *string) (*string, error) {
657657
giVersionMajor := strings.Split(*giVersionComputed, ".")[0]
658658
giVersionMajor = giVersionMajor + ".0.0.0"
659-
regxGiVersionMajor := regexp.MustCompile(MajorGiVersionPattern)
659+
regxGiVersionMajor := regexache.MustCompile(MajorGiVersionPattern)
660660
if !regxGiVersionMajor.MatchString(giVersionMajor) {
661661
err := errors.New("gi_version major retrieved from gi_version_computed does not match the pattern 19.0.0.0")
662662
return nil, err

internal/service/odb/cloud_vm_cluster_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func TestAccODBCloudVmCluster_taggingTest(t *testing.T) {
173173
})
174174
}
175175

176-
func TestAccODBCloudVmClusterReal_basic(t *testing.T) {
176+
func TestAccODBCloudVmCluster_real(t *testing.T) {
177177
ctx := acctest.Context(t)
178178
if testing.Short() {
179179
t.Skip("skipping long-running test in short mode")

0 commit comments

Comments
 (0)