Skip to content

Commit a479da4

Browse files
committed
use ToPtr
1 parent 260c7b5 commit a479da4

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pkg/operator/controllers/previewfeature/nsgflowlogs/nsgflowlogs.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm"
1111
sdknetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"
1212
"github.com/Azure/go-autorest/autorest/azure"
13-
"k8s.io/utils/ptr"
1413

1514
aropreviewv1alpha1 "github.com/Azure/ARO-RP/pkg/operator/apis/preview.aro.openshift.io/v1alpha1"
1615
"github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/armnetwork"
16+
"github.com/Azure/ARO-RP/pkg/util/pointerutils"
1717
"github.com/Azure/ARO-RP/pkg/util/subnet"
1818
)
1919

@@ -82,10 +82,10 @@ func (n *nsgFlowLogsFeature) newFlowLog(instance *aropreviewv1alpha1.PreviewFeat
8282
Location: &n.location,
8383
Properties: &sdknetwork.FlowLogPropertiesFormat{
8484
TargetResourceID: &nsgID,
85-
Enabled: ptr.To(true),
85+
Enabled: pointerutils.ToPtr(true),
8686
Format: &sdknetwork.FlowLogFormatParameters{
87-
Type: ptr.To(sdknetwork.FlowLogFormatTypeJSON),
88-
Version: ptr.To(int32(instance.Spec.NSGFlowLogs.Version)),
87+
Type: pointerutils.ToPtr(sdknetwork.FlowLogFormatTypeJSON),
88+
Version: pointerutils.ToPtr(int32(instance.Spec.NSGFlowLogs.Version)),
8989
},
9090
RetentionPolicy: &sdknetwork.RetentionPolicyParameters{
9191
Days: &instance.Spec.NSGFlowLogs.RetentionDays,
@@ -94,7 +94,7 @@ func (n *nsgFlowLogsFeature) newFlowLog(instance *aropreviewv1alpha1.PreviewFeat
9494
FlowAnalyticsConfiguration: &sdknetwork.TrafficAnalyticsProperties{
9595
NetworkWatcherFlowAnalyticsConfiguration: &sdknetwork.TrafficAnalyticsConfigurationProperties{
9696
WorkspaceID: &instance.Spec.NSGFlowLogs.TrafficAnalyticsLogAnalyticsWorkspaceID,
97-
TrafficAnalyticsInterval: ptr.To(int32(instance.Spec.NSGFlowLogs.TrafficAnalyticsInterval.Truncate(time.Minute).Minutes())),
97+
TrafficAnalyticsInterval: pointerutils.ToPtr(int32(instance.Spec.NSGFlowLogs.TrafficAnalyticsInterval.Truncate(time.Minute).Minutes())),
9898
},
9999
},
100100
},

pkg/operator/controllers/previewfeature/nsgflowlogs/nsgflowlogs_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import (
1111
"github.com/Azure/go-autorest/autorest/to"
1212
"go.uber.org/mock/gomock"
1313
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14-
"k8s.io/utils/ptr"
1514

1615
aropreviewv1alpha1 "github.com/Azure/ARO-RP/pkg/operator/apis/preview.aro.openshift.io/v1alpha1"
1716
mock_armnetwork "github.com/Azure/ARO-RP/pkg/util/mocks/azureclient/azuresdk/armnetwork"
1817
mock_subnet "github.com/Azure/ARO-RP/pkg/util/mocks/subnet"
18+
"github.com/Azure/ARO-RP/pkg/util/pointerutils"
1919
"github.com/Azure/ARO-RP/pkg/util/subnet"
2020
utilerror "github.com/Azure/ARO-RP/test/util/error"
2121
)
@@ -60,20 +60,20 @@ func getValidPreviewFeatureInstance() *aropreviewv1alpha1.PreviewFeature {
6060
func getValidFlowLogFeature() *armnetwork.FlowLog {
6161
return &armnetwork.FlowLog{
6262
Properties: &armnetwork.FlowLogPropertiesFormat{
63-
TargetResourceID: ptr.To(""),
64-
Enabled: ptr.To(true),
65-
StorageID: ptr.To(""),
63+
TargetResourceID: pointerutils.ToPtr(""),
64+
Enabled: pointerutils.ToPtr(true),
65+
StorageID: pointerutils.ToPtr(""),
6666
RetentionPolicy: &armnetwork.RetentionPolicyParameters{
67-
Days: ptr.To(int32(0)),
67+
Days: pointerutils.ToPtr(int32(0)),
6868
},
6969
Format: &armnetwork.FlowLogFormatParameters{
70-
Type: ptr.To(armnetwork.FlowLogFormatTypeJSON),
71-
Version: ptr.To(int32(0)),
70+
Type: pointerutils.ToPtr(armnetwork.FlowLogFormatTypeJSON),
71+
Version: pointerutils.ToPtr(int32(0)),
7272
},
7373
FlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsProperties{
7474
NetworkWatcherFlowAnalyticsConfiguration: &armnetwork.TrafficAnalyticsConfigurationProperties{
75-
TrafficAnalyticsInterval: ptr.To(int32(0)),
76-
WorkspaceID: ptr.To(""),
75+
TrafficAnalyticsInterval: pointerutils.ToPtr(int32(0)),
76+
WorkspaceID: pointerutils.ToPtr(""),
7777
},
7878
},
7979
},

0 commit comments

Comments
 (0)