-
Notifications
You must be signed in to change notification settings - Fork 191
[ARO-21136] add network security perimeter to some resources #4396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ package generator | |
| import ( | ||
| "fmt" | ||
|
|
||
| "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6" | ||
| "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v7" | ||
| mgmtdns "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns" | ||
| mgmtkeyvault "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2019-09-01/keyvault" | ||
| mgmtinsights "github.com/Azure/azure-sdk-for-go/services/preview/monitor/mgmt/2018-03-01/insights" | ||
|
|
@@ -44,6 +44,55 @@ func (g *generator) dnsZone(name string) *arm.Resource { | |
| } | ||
| } | ||
|
|
||
| func (g *generator) networkSecurityPerimeter(name string) *arm.Resource { | ||
| return &arm.Resource{ | ||
| Resource: &armnetwork.SecurityPerimeter{ | ||
| Location: pointerutils.ToPtr("[resourceGroup().location]"), | ||
| Properties: &armnetwork.SecurityPerimeterProperties{}, | ||
| Name: &name, | ||
| Type: pointerutils.ToPtr("Microsoft.Network/networkSecurityPerimeters"), | ||
| }, | ||
| APIVersion: azureclient.APIVersion("Microsoft.Network/networkSecurityPerimeters"), | ||
| } | ||
| } | ||
|
|
||
| // networkSecurityPerimeterProfile creates a new nsp profile with the hardcoded name `default`. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reading the code, this func creates a resource with name |
||
| func (g *generator) networkSecurityPerimeterProfile(nspName string) *arm.Resource { | ||
| return &arm.Resource{ | ||
| Resource: &armnetwork.NspProfile{ | ||
| Name: pointerutils.ToPtr(fmt.Sprintf("%s/default", nspName)), | ||
| Type: pointerutils.ToPtr("Microsoft.Network/networkSecurityPerimeters/profiles"), | ||
| }, | ||
| APIVersion: azureclient.APIVersion("Microsoft.Network/networkSecurityPerimeters/profiles"), | ||
| DependsOn: []string{ | ||
| fmt.Sprintf("[resourceId('Microsoft.Network/networkSecurityPerimeters', '%s')]", nspName), | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func (g *generator) networkSecurityPerimeterAssociation(nspName string, associationName string, targetResourceId string) *arm.Resource { | ||
| return &arm.Resource{ | ||
| Resource: &armnetwork.NspAssociation{ | ||
| Properties: &armnetwork.NspAssociationProperties{ | ||
| AccessMode: pointerutils.ToPtr(armnetwork.AssociationAccessModeLearning), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: if some day we want to move this to enforce or audit... would it be worth to have it as a func parameter? I like how clean looks right now, so it's not a deal breaker. |
||
| PrivateLinkResource: &armnetwork.SubResource{ | ||
| ID: &targetResourceId, | ||
| }, | ||
| Profile: &armnetwork.SubResource{ | ||
| ID: pointerutils.ToPtr(fmt.Sprintf("[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', '%s', 'default')]", nspName)), | ||
| }, | ||
| }, | ||
| Name: pointerutils.ToPtr(fmt.Sprintf("%s/%s", nspName, associationName)), | ||
| Type: pointerutils.ToPtr("Microsoft.Network/networkSecurityPerimeters/resourceAssociations"), | ||
| }, | ||
| APIVersion: azureclient.APIVersion("Microsoft.Network/networkSecurityPerimeters/resourceAssociations"), | ||
| DependsOn: []string{ | ||
| fmt.Sprintf("[resourceId('Microsoft.Network/networkSecurityPerimeters/profiles', '%s', 'default')]", nspName), | ||
| targetResourceId, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func (g *generator) securityGroup(name string, securityRules []*armnetwork.SecurityRule, condition interface{}) *arm.Resource { | ||
| return &arm.Resource{ | ||
| Resource: &armnetwork.SecurityGroup{ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.