From c2a0ac89c2b4f58bcf84bd5d73cc371cd65071ab Mon Sep 17 00:00:00 2001 From: bennerv <10840174+bennerv@users.noreply.github.com> Date: Wed, 8 May 2024 09:25:32 -0500 Subject: [PATCH] Update preconfiguredNSG to networkSecurityGroupID --- .../HcpCluster/hcpCluster-models.tsp | 4 ++-- .../preview/2024-06-10-preview/openapi.json | 8 ++++---- internal/api/hcpopenshiftcluster.go | 5 +++-- internal/api/v20240610preview/generated_models.go | 4 ++-- .../api/v20240610preview/generated_models_serde.go | 8 ++++---- .../hcpopenshiftclusters_methods.go | 14 +++++++------- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp index 7e115e39e..7b6b7b18b 100644 --- a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp +++ b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp @@ -258,8 +258,8 @@ model PlatformProfile { /** The core outgoing configuration */ outboundType?: OutboundType = OutboundType.loadBalancer; - /** Specifies whether subnets are pre-attached with an NSG */ - preconfiguredNsgs: boolean; + /** ResourceId for the network security group attached to the cluster subnet */ + networkSecurityGroupId: string; /** The id of the disk encryption set to be used for etcd. * Configure this when `etcdEncryption` is set to true diff --git a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json index 671ec8c7e..412f3e8ec 100644 --- a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json +++ b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json @@ -1984,9 +1984,9 @@ ] } }, - "preconfiguredNsgs": { - "type": "boolean", - "description": "Specifies whether subnets are pre-attached with an NSG" + "networkSecurityGroupId": { + "type": "string", + "description": "ResourceId for the network security group attached to the cluster subnet" }, "etcdEncryptionSetId": { "type": "string", @@ -1996,7 +1996,7 @@ "required": [ "managedResourceGroup", "subnetId", - "preconfiguredNsgs" + "networkSecurityGroupId" ] }, "ProvisioningState": { diff --git a/internal/api/hcpopenshiftcluster.go b/internal/api/hcpopenshiftcluster.go index bd59cf479..9aa04b3d1 100644 --- a/internal/api/hcpopenshiftcluster.go +++ b/internal/api/hcpopenshiftcluster.go @@ -89,8 +89,9 @@ type PlatformProfile struct { ManagedResourceGroup string `json:"managedResourceGroup,omitempty" validate:"required_for_put"` SubnetID string `json:"subnetId,omitempty" validate:"required_for_put"` OutboundType OutboundType `json:"outboundType,omitempty" validate:"omitempty,enum_outboundtype"` - PreconfiguredNSGs bool `json:"preconfiguredNsgs,omitempty"` - EtcdEncryptionSetID string `json:"etcdEncryptionSetId,omitempty"` + //TODO: Is nsg required for PUT, or will we create if not specified? + NetworkSecurityGroupID string `json:"networkSecurityGroupId,omitempty" validate:"required_for_put"` + EtcdEncryptionSetID string `json:"etcdEncryptionSetId,omitempty"` } // ExternalAuthConfigProfile represents the external authentication configuration. diff --git a/internal/api/v20240610preview/generated_models.go b/internal/api/v20240610preview/generated_models.go index 9c03cd14f..2c8155e76 100644 --- a/internal/api/v20240610preview/generated_models.go +++ b/internal/api/v20240610preview/generated_models.go @@ -569,8 +569,8 @@ type PlatformProfile struct { // REQUIRED; Resource group to put cluster resources ManagedResourceGroup *string - // REQUIRED; Specifies whether subnets are pre-attached with an NSG - PreconfiguredNsgs *bool + // REQUIRED; ResourceId for the network security group attached to the cluster subnet + NetworkSecurityGroupID *string // REQUIRED; ResourceId for the subnet used by the control plane SubnetID *string diff --git a/internal/api/v20240610preview/generated_models_serde.go b/internal/api/v20240610preview/generated_models_serde.go index 71c1f01bf..a51fb6f7f 100644 --- a/internal/api/v20240610preview/generated_models_serde.go +++ b/internal/api/v20240610preview/generated_models_serde.go @@ -1464,8 +1464,8 @@ func (p PlatformProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etcdEncryptionSetId", p.EtcdEncryptionSetID) populate(objectMap, "managedResourceGroup", p.ManagedResourceGroup) + populate(objectMap, "networkSecurityGroupId", p.NetworkSecurityGroupID) populate(objectMap, "outboundType", p.OutboundType) - populate(objectMap, "preconfiguredNsgs", p.PreconfiguredNsgs) populate(objectMap, "subnetId", p.SubnetID) return json.Marshal(objectMap) } @@ -1485,12 +1485,12 @@ func (p *PlatformProfile) UnmarshalJSON(data []byte) error { case "managedResourceGroup": err = unpopulate(val, "ManagedResourceGroup", &p.ManagedResourceGroup) delete(rawMsg, key) + case "networkSecurityGroupId": + err = unpopulate(val, "NetworkSecurityGroupID", &p.NetworkSecurityGroupID) + delete(rawMsg, key) case "outboundType": err = unpopulate(val, "OutboundType", &p.OutboundType) delete(rawMsg, key) - case "preconfiguredNsgs": - err = unpopulate(val, "PreconfiguredNsgs", &p.PreconfiguredNsgs) - delete(rawMsg, key) case "subnetId": err = unpopulate(val, "SubnetID", &p.SubnetID) delete(rawMsg, key) diff --git a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go b/internal/api/v20240610preview/hcpopenshiftclusters_methods.go index 49f9ef658..2842ee8de 100644 --- a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go +++ b/internal/api/v20240610preview/hcpopenshiftclusters_methods.go @@ -62,11 +62,11 @@ func newProxyProfile(from *api.ProxyProfile) *ProxyProfile { func newPlatformProfile(from *api.PlatformProfile) *PlatformProfile { return &PlatformProfile{ - ManagedResourceGroup: api.Ptr(from.ManagedResourceGroup), - SubnetID: api.Ptr(from.SubnetID), - OutboundType: api.Ptr(OutboundType(from.OutboundType)), - PreconfiguredNsgs: api.Ptr(from.PreconfiguredNSGs), - EtcdEncryptionSetID: api.Ptr(from.EtcdEncryptionSetID), + ManagedResourceGroup: api.Ptr(from.ManagedResourceGroup), + SubnetID: api.Ptr(from.SubnetID), + OutboundType: api.Ptr(OutboundType(from.OutboundType)), + NetworkSecurityGroupID: api.Ptr(from.NetworkSecurityGroupID), + EtcdEncryptionSetID: api.Ptr(from.EtcdEncryptionSetID), } } @@ -407,8 +407,8 @@ func (p *PlatformProfile) Normalize(out *api.PlatformProfile) { if p.OutboundType != nil { out.OutboundType = api.OutboundType(*p.OutboundType) } - if p.PreconfiguredNsgs != nil { - out.PreconfiguredNSGs = *p.PreconfiguredNsgs + if p.NetworkSecurityGroupID != nil { + out.NetworkSecurityGroupID = *p.NetworkSecurityGroupID } if p.EtcdEncryptionSetID != nil { out.EtcdEncryptionSetID = *p.EtcdEncryptionSetID