Skip to content

Commit f60f6c0

Browse files
author
Maddie Clayton
authored
Merge branch 'network-september-release' into AzureFirewallNatAndFqdnTags
2 parents 81c7f26 + 8939a4b commit f60f6c0

File tree

13 files changed

+2874
-2373
lines changed

13 files changed

+2874
-2373
lines changed

src/ResourceManager/Network/Commands.Network/Az.Network.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
387387
'New-AzFirewallNatRuleCollection',
388388
'New-AzFirewallNatRule',
389389
'New-AzFirewallNetworkRuleCollection',
390-
'New-AzFirewallNetworkRule'
390+
'New-AzFirewallNetworkRule',
391+
'Get-AzInterfaceEndpoint'
391392

392393
# Variables to export from this module
393394
# VariablesToExport = @()

src/ResourceManager/Network/Commands.Network/AzureRM.Network.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ CmdletsToExport = 'Add-AzureRmApplicationGatewayAuthenticationCertificate',
388388
'New-AzureRmFirewallNatRuleCollection',
389389
'New-AzureRmFirewallNatRule',
390390
'New-AzureRmFirewallNetworkRuleCollection',
391-
'New-AzureRmFirewallNetworkRule'
391+
'New-AzureRmFirewallNetworkRule',
392+
'Get-AzureRmInterfaceEndpoint'
392393

393394
# Variables to export from this module
394395
# VariablesToExport = @()

src/ResourceManager/Network/Commands.Network/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
Please leave this section at the top of the change log.
33
44
Changes for the current release should go under the section titled "Current Release", and should adhere to the following format:
@@ -62,6 +62,7 @@
6262
- Cmdlets updated with optonal parameter -AutoscaleConfiguration
6363
- New-AzureRmApplicationGateway
6464
- Set-AzureRmApplicationGateway
65+
* Add cmdlet for Interface Endpoint Get-AzureInterfaceEndpoint
6566

6667
## Version 6.7.0
6768
* Updated cmdlet New-AzureRmVirtualNetworkGatewayConnection with support for switch ExpressRouteGatewayBypass

src/ResourceManager/Network/Commands.Network/Commands.Network.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
<Compile Include="AzureFirewall\NewAzureFirewallCommand.cs" />
198198
<Compile Include="AzureFirewall\RemoveAzureFirewallCommand.cs" />
199199
<Compile Include="AzureFirewall\SetAzureFirewallCommand.cs" />
200+
<Compile Include="InterfaceEndpoint\AzureInterfaceEndpointBaseCmdlet.cs" />
200201
<Compile Include="Generated\ApplicationSecurityGroup\GetAzureRMApplicationSecurityGroupCommand.cs" />
201202
<Compile Include="Generated\ApplicationSecurityGroup\NewAzureRMApplicationSecurityGroupCommand.cs" />
202203
<Compile Include="Generated\ApplicationSecurityGroup\RemoveAzureRMApplicationSecurityGroupCommand.cs" />
@@ -360,6 +361,7 @@
360361
<Compile Include="Generated\Models\PSResourceNavigationLink.cs" />
361362
<Compile Include="Generated\Models\PSTroubleshootingDetails.cs" />
362363
<Compile Include="Generated\Models\PSTroubleshootingRecommendedActions.cs" />
364+
<Compile Include="InterfaceEndpoint\GetAzureInterfaceEndpointCommand.cs" />
363365
<Compile Include="Models\PSTrafficAnalyticsConfigurationProperties.cs" />
364366
<Compile Include="Models\PSTrafficAnalyticsProperties.cs" />
365367
<Compile Include="Generated\Models\PSTunnelConnectionHealth.cs" />
@@ -547,6 +549,8 @@
547549
<Compile Include="NetworkWatcher\GetAzureNetworkWatcherReachabilityProvidersListCommand.cs" />
548550
<Compile Include="NetworkWatcher\GetAzureRMNetworkWatcherReachabilityReportCommand.cs" />
549551
<Compile Include="ProviderWideCmdlets\GetAzureExpressRouteServiceProviderCommand.cs" />
552+
<Compile Include="Models\PSEndpointService.cs" />
553+
<Compile Include="Models\PSInterfaceEndpoint.cs" />
550554
<Compile Include="PublicIpPrefix\GetAzurePublicIpPrefixCommand.cs" />
551555
<Compile Include="PublicIpPrefix\NewAzurePublicIpPrefixCommand.cs" />
552556
<Compile Include="PublicIpPrefix\PublicIpPrefixBaseCmdlet.cs" />

src/ResourceManager/Network/Commands.Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,19 @@ private static void Initialize()
816816
cfg.CreateMap<MNM.AzureFirewallNatRCAction, CNM.PSAzureFirewallNatRCAction>();
817817
cfg.CreateMap<MNM.AzureFirewallRCAction, CNM.PSAzureFirewallRCAction>();
818818
cfg.CreateMap<MNM.AzureFirewallApplicationRuleProtocol, CNM.PSAzureFirewallApplicationRuleProtocol>();
819+
820+
// Interface endpoint
821+
// CNM to MNM
822+
cfg.CreateMap<CNM.PSInterfaceEndpoint, MNM.InterfaceEndpoint>();
823+
824+
// MNM to CNM
825+
cfg.CreateMap<MNM.InterfaceEndpoint, CNM.PSInterfaceEndpoint>();
826+
827+
// CNM to MNM
828+
cfg.CreateMap<CNM.PSEndpointService, MNM.EndpointService>();
829+
830+
// MNM to CNM
831+
cfg.CreateMap<MNM.EndpointService, CNM.PSEndpointService>();
819832
});
820833

821834
_mapper = config.CreateMapper();
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+

2+
// ----------------------------------------------------------------------------------
3+
//
4+
// Copyright Microsoft Corporation
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
// ----------------------------------------------------------------------------------
15+
16+
namespace Microsoft.Azure.Commands.Network
17+
{
18+
using Microsoft.Azure.Commands.Network.Models;
19+
using System.Net;
20+
using Microsoft.Azure.Management.Network;
21+
using Microsoft.Azure.Management.Network.Models;
22+
using System.Collections.Generic;
23+
using Microsoft.Rest.Azure;
24+
25+
public abstract class AzureInterfaceEndpointBaseCmdlet : NetworkBaseCmdlet
26+
{
27+
public IInterfaceEndpointsOperations InterfaceEndpointClient
28+
{
29+
get
30+
{
31+
return NetworkClient.NetworkManagementClient.InterfaceEndpoints;
32+
}
33+
}
34+
35+
public bool IsServiceEndpointPolicyPresent(string resourceGroupName, string name)
36+
{
37+
try
38+
{
39+
GetInterfaceEndpoint(resourceGroupName, name);
40+
}
41+
catch (Microsoft.Rest.Azure.CloudException exception)
42+
{
43+
if (exception.Response.StatusCode == HttpStatusCode.NotFound)
44+
{
45+
// Resource is not present
46+
return false;
47+
}
48+
49+
throw;
50+
}
51+
52+
return true;
53+
}
54+
55+
public PSInterfaceEndpoint GetInterfaceEndpoint(string resourceGroupName, string name, string expandResource = null)
56+
{
57+
var interfaceEndpoint = this.InterfaceEndpointClient.Get(resourceGroupName, name, expandResource);
58+
59+
var pSInterfaceEndpoint = ToInterfaceEndpoint(interfaceEndpoint);
60+
pSInterfaceEndpoint.ResourceGroupName = resourceGroupName;
61+
62+
return pSInterfaceEndpoint;
63+
}
64+
65+
public IEnumerable<PSInterfaceEndpoint> ListInterfaceEndpoints(string resourceGroupName)
66+
{
67+
var interfaceEndpoints = this.InterfaceEndpointClient.List(resourceGroupName);
68+
69+
List<PSInterfaceEndpoint> pSInterfaceEndpoints = new List<PSInterfaceEndpoint>();
70+
foreach (var interfaceEndpoint in interfaceEndpoints)
71+
{
72+
var pSInterfaceEndpoint = ToInterfaceEndpoint(interfaceEndpoint);
73+
pSInterfaceEndpoint.ResourceGroupName = resourceGroupName;
74+
pSInterfaceEndpoints.Add(pSInterfaceEndpoint);
75+
}
76+
77+
return pSInterfaceEndpoints;
78+
}
79+
80+
public PSInterfaceEndpoint ToInterfaceEndpoint(InterfaceEndpoint interfaceEndpoint)
81+
{
82+
var pSInterfaceEndpoint = NetworkResourceManagerProfile.Mapper.Map<PSInterfaceEndpoint>(interfaceEndpoint);
83+
return pSInterfaceEndpoint;
84+
}
85+
}
86+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.Network
16+
{
17+
using Microsoft.Azure.Commands.Network.Models;
18+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
19+
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
20+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
21+
using System.Collections.Generic;
22+
using System.Management.Automation;
23+
24+
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "InterfaceEndpoint", SupportsShouldProcess = true, DefaultParameterSetName = "GetByNameParameterSet"), OutputType(typeof(PSInterfaceEndpoint))]
25+
public class GetInterfaceEndpointCommand : AzureInterfaceEndpointBaseCmdlet
26+
{
27+
[Parameter(
28+
Mandatory = false,
29+
ParameterSetName = "GetByNameParameterSet",
30+
HelpMessage = "The name of the interface endpoint")]
31+
[ValidateNotNullOrEmpty]
32+
public string Name { get; set; }
33+
34+
[Parameter(
35+
Mandatory = true,
36+
ValueFromPipelineByPropertyName = true,
37+
HelpMessage = "The resource group name.",
38+
ParameterSetName = "GetByNameParameterSet")]
39+
[ResourceGroupCompleter]
40+
[ValidateNotNullOrEmpty]
41+
public virtual string ResourceGroupName { get; set; }
42+
43+
[Parameter(
44+
Mandatory = true,
45+
ValueFromPipelineByPropertyName = true,
46+
ParameterSetName = "GetByResourceIdParameterSet")]
47+
[ValidateNotNullOrEmpty]
48+
public virtual string ResourceId { get; set; }
49+
50+
public override void Execute()
51+
{
52+
if (this.ShouldProcess(Name, VerbsLifecycle.Restart))
53+
{
54+
base.Execute();
55+
56+
if (this.IsParameterBound(c => c.ResourceId))
57+
{
58+
var resourceIdentifier = new ResourceIdentifier(this.ResourceId);
59+
this.ResourceGroupName = resourceIdentifier.ResourceGroupName;
60+
this.Name = resourceIdentifier.ResourceName;
61+
}
62+
63+
if (!string.IsNullOrEmpty(this.Name))
64+
{
65+
PSInterfaceEndpoint psInterfaceEndpoint;
66+
psInterfaceEndpoint = this.GetInterfaceEndpoint(this.ResourceGroupName, this.Name);
67+
WriteObject(psInterfaceEndpoint);
68+
}
69+
else
70+
{
71+
IEnumerable<PSInterfaceEndpoint> interfaceEndpoints = null;
72+
if (!string.IsNullOrEmpty(this.ResourceGroupName))
73+
{
74+
interfaceEndpoints = ListInterfaceEndpoints(this.ResourceGroupName);
75+
}
76+
77+
WriteObject(interfaceEndpoints, true);
78+
}
79+
}
80+
}
81+
}
82+
}

src/ResourceManager/Network/Commands.Network/Microsoft.Azure.Commands.Network.format.ps1xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@
804804
<Label>ServiceEndpointPolicies</Label>
805805
<PropertyName>ServiceEndpointPoliciesText</PropertyName>
806806
</ListItem>
807+
<ListItem>
808+
<Label>InterfaceEndpoints</Label>
809+
<PropertyName>InterfaceEndpointsText</PropertyName>
810+
</ListItem>
807811
</ListItems>
808812
</ListEntry>
809813
</ListEntries>
@@ -1419,6 +1423,85 @@
14191423
</ListEntries>
14201424
</ListControl>
14211425
</View>
1426+
<View>
1427+
<Name>Microsoft.Azure.Commands.Network.Models.PSInterfaceEndpoint</Name>
1428+
<ViewSelectedBy>
1429+
<TypeName>Microsoft.Azure.Commands.Network.Models.PSInterfaceEndpoint</TypeName>
1430+
</ViewSelectedBy>
1431+
<ListControl>
1432+
<ListEntries>
1433+
<ListEntry>
1434+
<ListItems>
1435+
<ListItem>
1436+
<Label>Name</Label>
1437+
<PropertyName>Name</PropertyName>
1438+
</ListItem>
1439+
<ListItem>
1440+
<Label>ResourceGroupName</Label>
1441+
<PropertyName>ResourceGroupName</PropertyName>
1442+
</ListItem>
1443+
<ListItem>
1444+
<Label>Location</Label>
1445+
<PropertyName>Location</PropertyName>
1446+
</ListItem>
1447+
<ListItem>
1448+
<Label>Id</Label>
1449+
<PropertyName>Id</PropertyName>
1450+
</ListItem>
1451+
<ListItem>
1452+
<Label>Etag</Label>
1453+
<PropertyName>Etag</PropertyName>
1454+
</ListItem>
1455+
<ListItem>
1456+
<Label>ResourceGuid</Label>
1457+
<PropertyName>ResourceGuid</PropertyName>
1458+
</ListItem>
1459+
<ListItem>
1460+
<Label>ProvisioningState</Label>
1461+
<PropertyName>ProvisioningState</PropertyName>
1462+
</ListItem>
1463+
<ListItem>
1464+
<Label>EndpointService</Label>
1465+
<PropertyName>EndpointServiceText</PropertyName>
1466+
</ListItem>
1467+
<ListItem>
1468+
<Label>Subnet</Label>
1469+
<PropertyName>SubnetText</PropertyName>
1470+
</ListItem>
1471+
<ListItem>
1472+
<Label>Owner</Label>
1473+
<PropertyName>Owner</PropertyName>
1474+
</ListItem> <ListItem>
1475+
<Label>Fqdn</Label>
1476+
<PropertyName>Fqdn</PropertyName>
1477+
</ListItem>
1478+
<ListItem>
1479+
<Label>NetworkInterfaces</Label>
1480+
<PropertyName>NetworkInterfacesText</PropertyName>
1481+
</ListItem>
1482+
</ListItems>
1483+
</ListEntry>
1484+
</ListEntries>
1485+
</ListControl>
1486+
</View>
1487+
<View>
1488+
<Name>Microsoft.Azure.Commands.Network.Models.PSEndpointService</Name>
1489+
<ViewSelectedBy>
1490+
<TypeName>Microsoft.Azure.Commands.Network.Models.PSEndpointService</TypeName>
1491+
</ViewSelectedBy>
1492+
<ListControl>
1493+
<ListEntries>
1494+
<ListEntry>
1495+
<ListItems>
1496+
<ListItem>
1497+
<Label>Id</Label>
1498+
<PropertyName>Id</PropertyName>
1499+
</ListItem>
1500+
</ListItems>
1501+
</ListEntry>
1502+
</ListEntries>
1503+
</ListControl>
1504+
</View>
14221505
<View>
14231506
<Name>Microsoft.Azure.Commands.Network.Models.PSServiceEndpointPolicyDefinition</Name>
14241507
<ViewSelectedBy>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
namespace Microsoft.Azure.Commands.Network.Models
17+
{
18+
using Newtonsoft.Json;
19+
20+
public class PSEndpointService
21+
{
22+
[JsonProperty(Order = 1)]
23+
public string Id { get; set; }
24+
}
25+
}

0 commit comments

Comments
 (0)