From bc9e8b89254c59e7550ae779f6051d7aa0f333be Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Thu, 16 Apr 2015 12:06:41 -0700 Subject: [PATCH 01/10] Updated ExpressRoute commandlets to latest Hydra specs --- setup/azurecmdfiles.wxi | 1054 +++++++++++++++++ .../BgpPeerings/NewAzureBGPPeering.cs | 16 +- .../BgpPeerings/SetAzureBGPPeering.cs | 23 +- .../Commands.ExpressRoute.csproj | 15 +- .../GetAzureCrossConnection.cs | 56 + .../NewAzureCrossConnections.cs | 50 + .../SetAzureCrossConnection.cs | 47 + .../ExpressRouteClient.cs | 22 +- .../Properties/Resources.Designer.cs | 27 + .../Properties/Resources.resx | 9 + .../Commands.ExpressRoute/packages.config | 6 +- .../Commands.Test/Commands.Test.csproj | 16 +- .../Services/Commands.Test/packages.config | 4 +- 13 files changed, 1315 insertions(+), 30 deletions(-) create mode 100644 src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs create mode 100644 src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs create mode 100644 src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index b64dd70a8798..e42e8f4896e4 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -97,6 +97,15 @@ + + + + + + + + + @@ -180,6 +189,15 @@ + + + + + + + + + @@ -198,6 +216,9 @@ + + + @@ -266,6 +287,9 @@ + + + @@ -339,6 +363,15 @@ + + + + + + + + + @@ -408,6 +441,12 @@ + + + + + + @@ -441,15 +480,30 @@ + + + + + + + + + + + + + + + @@ -459,9 +513,18 @@ + + + + + + + + + @@ -471,30 +534,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -504,6 +609,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -607,6 +974,15 @@ + + + + + + + + + @@ -652,6 +1028,9 @@ + + + @@ -742,6 +1121,423 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -878,6 +1674,9 @@ + + + @@ -1265,6 +2064,9 @@ + + + @@ -1618,6 +2420,9 @@ + + + @@ -2080,6 +2885,9 @@ + + + @@ -2501,6 +3309,9 @@ + + + @@ -2528,12 +3339,16 @@ + + + + @@ -2556,6 +3371,7 @@ + @@ -2579,6 +3395,9 @@ + + + @@ -2602,6 +3421,8 @@ + + @@ -2613,27 +3434,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2667,6 +3586,9 @@ + + + @@ -2682,6 +3604,7 @@ + @@ -2711,6 +3634,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2754,6 +3804,7 @@ + @@ -2881,6 +3932,7 @@ + @@ -2996,6 +4048,7 @@ + @@ -3138,6 +4191,7 @@ + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs index 0735add9bb3a..97f2b4d3e3a6 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs @@ -27,6 +27,13 @@ public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [ValidateNotNullOrEmpty] public string ServiceKey { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Advertised Public Prefixes")] + [ValidateNotNullOrEmpty] + public string AdvertisedPublicPrefixes { get; set; } + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Customer AS number")] + public UInt32 CustomerAsn { get; set; } + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Peer Asn")] public UInt32 PeerAsn { get; set; } @@ -35,6 +42,9 @@ public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [ValidateNotNullOrEmpty] public string PrimaryPeerSubnet { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Routing Registry Name for Prefix Validation")] + public string RoutingRegistryName { get; set; } + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Secondary Peer Subnet")] [ValidateNotNullOrEmpty] public string SecondaryPeerSubnet { get; set; } @@ -46,14 +56,14 @@ public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Vlan Id")] public UInt32 VlanId { get; set; } - [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Public or Private")] + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Microsoft, Public or Private")] [DefaultValue("Private")] public BgpPeeringAccessType AccessType { get; set; } public override void ExecuteCmdlet() { - var route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAsn, PrimaryPeerSubnet, - SecondaryPeerSubnet, VlanId, AccessType, SharedKey); + var route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, AdvertisedPublicPrefixes, CustomerAsn, PeerAsn, + PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId, AccessType, SharedKey); WriteObject(route); } } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs index 085123494a51..cfd1717d48d2 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs @@ -20,6 +20,8 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + using ServiceManagement.Model; + [Cmdlet(VerbsCommon.Set, "AzureBGPPeering"), OutputType(typeof(AzureBgpPeering))] public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet { @@ -28,6 +30,13 @@ public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [ValidateNotNullOrEmpty] public string ServiceKey { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Advertised Public Prefixes")] + [ValidateNotNullOrEmpty] + public string AdvertisedPublicPrefixes; + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Customer AS number")] + public UInt32 CustomerAsn { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Peer Asn")] public UInt32? PeerAsn { get; set; } @@ -36,6 +45,9 @@ public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [ValidateNotNullOrEmpty] public string PrimaryPeerSubnet { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Routing Registry Name for Prefix Validation")] + public string RoutingRegistryName { get; set; } + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Secondary Peer Subnet")] [ValidateNotNullOrEmpty] public string SecondaryPeerSubnet { get; set; } @@ -47,7 +59,7 @@ public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Vlan Id")] public UInt32? VlanId { get; set; } - [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Public or Private")] + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Microsoft, Public or Private")] [DefaultValue("Private")] public BgpPeeringAccessType AccessType { get; set; } @@ -56,8 +68,8 @@ public override void ExecuteCmdlet() try { var route = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType); - var updatedRoute = ExpressRouteClient.UpdateAzureBGPPeering(ServiceKey, AccessType, - PeerAsn.HasValue ? PeerAsn.Value : route.PeerAsn, PrimaryPeerSubnet ?? route.PrimaryPeerSubnet, + var updatedRoute = ExpressRouteClient.UpdateAzureBGPPeering(ServiceKey, AccessType, CustomerAsn, + PeerAsn.HasValue ? PeerAsn.Value : route.PeerAsn, PrimaryPeerSubnet ?? route.PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet ?? route.SecondaryPeerSubnet, VlanId.HasValue ? VlanId.Value : route.VlanId, SharedKey); WriteObject(updatedRoute, false); @@ -84,8 +96,9 @@ public override void ExecuteCmdlet() throw new ArgumentException(Resources.SecondaryPeerSubnetRequired); } - var newRoute = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAsn.Value, PrimaryPeerSubnet, - SecondaryPeerSubnet, VlanId.Value, AccessType, SharedKey); + var newRoute = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, AdvertisedPublicPrefixes, CustomerAsn, + PeerAsn.Value, PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId.Value, AccessType, + SharedKey); WriteObject(newRoute); } } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj index b87e560697e3..eec3d95d0647 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj @@ -44,15 +44,17 @@ ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.dll False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.NetFramework.dll False @@ -83,7 +85,7 @@ False - ..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.2-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll + ..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.3-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll @@ -122,6 +124,9 @@ + + + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs new file mode 100644 index 000000000000..e24cd92d57e9 --- /dev/null +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs @@ -0,0 +1,56 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +using System.Collections.Generic; +using System.Management.Automation; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; + +namespace Microsoft.WindowsAzure.Commands.ExpressRoute +{ + [Cmdlet(VerbsCommon.Get, "AzureCrossConnection"), OutputType(typeof(AzureCrossConnection), typeof(IEnumerable))] + public class GetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet + { + [Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, + HelpMessage = "Service Key representing the Dedicated Circuit")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ServiceKey { get; set; } + + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(ServiceKey)) + { + GetByServiceKey(); + } + else + { + GetNoServiceKey(); + } + } + + private void GetByServiceKey() + { + var crossConnection = ExpressRouteClient.GetAzureCrossConnection(ServiceKey); + WriteObject(crossConnection); + } + + private void GetNoServiceKey() + { + var crossConnections = ExpressRouteClient.ListAzureCrossConnections(); + WriteObject(crossConnections, true); + } + } +} + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs new file mode 100644 index 000000000000..c65d924523cc --- /dev/null +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs @@ -0,0 +1,50 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Management.Automation; +using Microsoft.WindowsAzure.Commands.ExpressRoute.Properties; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; + +namespace Microsoft.WindowsAzure.Commands.ExpressRoute +{ + [Cmdlet(VerbsCommon.New, "AzureCrossConnection"), OutputType(typeof(AzureCrossConnection))] + public class NewAzureCrossConnectionCommand : ExpressRouteBaseCmdlet + { + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, + HelpMessage = "Dedicated Circuit Service Key")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ServiceKey { get; set; } + + [Parameter(HelpMessage = "Do not confirm Azure Cross Connection creation")] + public SwitchParameter Force { get; set; } + + public override void ExecuteCmdlet() + { + ConfirmAction( + Force.IsPresent, + string.Format(Resources.NewAzureCrossConnectionWarning, ServiceKey), + string.Format(Resources.NewAzureCrossConnectionMessage, ServiceKey), + ServiceKey, + () => + { + var crossConnection = ExpressRouteClient.NewAzureCrossConnection(ServiceKey); + WriteVerboseWithTimestamp(Resources.NewAzureCrossConnectionSucceeded); + WriteObject(crossConnection); + }); + + } + } +} diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs new file mode 100644 index 000000000000..7c02fb6795fc --- /dev/null +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs @@ -0,0 +1,47 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.ComponentModel; +using System.Management.Automation; +using Microsoft.WindowsAzure.Commands.ExpressRoute.Properties; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; + +namespace Microsoft.WindowsAzure.Commands.ExpressRoute +{ + using ServiceManagement.Model; + + [Cmdlet(VerbsCommon.Set, "AzureCrossConnection"), OutputType(typeof(AzureCrossConnection))] + public class SetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet + { + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit for which BGP peering needs to be created/modified")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ServiceKey { get; set; } + + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Notification Operation to perform. NotifyCrossConnectionProvisioned or NotifyCrossConnectionNotProvisioned")] + [ValidateNotNullOrEmpty] + public UpdateCrossConnectionOperation Operation { get; set; } + + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Provisioning Error Message")] + public string ProvisioningError { get; set; } + + public override void ExecuteCmdlet() + { + var crossConnection = ExpressRouteClient.SetAzureCrossConnection(ServiceKey, + new CrossConnectionUpdateParameters() {Operation = Operation, ProvisioningError = ProvisioningError}); + WriteObject(crossConnection); + } + } +} diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs index b6619d3c79c0..4b1f52ee52aa 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs @@ -59,13 +59,17 @@ public AzureBgpPeering GetAzureBGPPeering(string serviceKey, BgpPeeringAccessTyp return Client.BorderGatewayProtocolPeerings.Get(serviceKey, accessType).BgpPeering; } - public AzureBgpPeering NewAzureBGPPeering(string serviceKey, UInt32 peerAsn, string primaryPeerSubnet, - string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null) + public AzureBgpPeering NewAzureBGPPeering(string serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, + UInt32 peerAsn, string primaryPeerSubnet, string routingRegistryName, string secondaryPeerSubnet, + UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null) { var result = Client.BorderGatewayProtocolPeerings.New(serviceKey, accessType, new BorderGatewayProtocolPeeringNewParameters() { + AdvertisedPublicPrefixes = advertisedPublicPrefixes, + CustomerAutonomousSystemNumber = customerAsn, PeerAutonomousSystemNumber = peerAsn, PrimaryPeerSubnet = primaryPeerSubnet, + RoutingRegistryName = routingRegistryName, SecondaryPeerSubnet = secondaryPeerSubnet, SharedKey = sharedKey, VirtualLanId = vlanId @@ -87,14 +91,19 @@ public bool RemoveAzureBGPPeering(string serviceKey, BgpPeeringAccessType access return result.HttpStatusCode.Equals(HttpStatusCode.OK); } - public AzureBgpPeering UpdateAzureBGPPeering(string serviceKey, - BgpPeeringAccessType accessType, UInt32 peerAsn, string primaryPeerSubnet, - string secondaryPeerSubnet, UInt32 vlanId, string sharedKey) + public AzureBgpPeering UpdateAzureBGPPeering(string serviceKey, + BgpPeeringAccessType accessType, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, + string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, string sharedKey) + + + { var result = Client.BorderGatewayProtocolPeerings.Update(serviceKey, accessType, new BorderGatewayProtocolPeeringUpdateParameters() { + CustomerAutonomousSystemNumber = customerAsn, PeerAutonomousSystemNumber = peerAsn, PrimaryPeerSubnet = primaryPeerSubnet, + RoutingRegistryName = routingRegistryName, SecondaryPeerSubnet = secondaryPeerSubnet, SharedKey = sharedKey, VirtualLanId = vlanId, @@ -144,7 +153,7 @@ public AzureDedicatedCircuit SetAzureDedicatedCircuitBandwidth(string serviceKey { var result = Client.DedicatedCircuits.Update(serviceKey, (new DedicatedCircuitUpdateParameters() { - Bandwidth = bandwidth + Bandwidth = bandwidth.ToString() })); if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) @@ -298,5 +307,6 @@ public bool RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(string serv }); return result.StatusCode.Equals(HttpStatusCode.OK); } + } } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.Designer.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.Designer.cs index fcbe1794622a..98b22e6cdc4f 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.Designer.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.Designer.cs @@ -69,6 +69,33 @@ internal static string InvalidGuid { } } + /// + /// Looks up a localized string similar to Provisioning Cross Connection for service key {0}. + /// + internal static string NewAzureCrossConnectionMessage { + get { + return ResourceManager.GetString("NewAzureCrossConnectionMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Successfully provisioned cross connection. + /// + internal static string NewAzureCrossConnectionSucceeded { + get { + return ResourceManager.GetString("NewAzureCrossConnectionSucceeded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to provision a cross connection for service key {0}?. + /// + internal static string NewAzureCrossConnectionWarning { + get { + return ResourceManager.GetString("NewAzureCrossConnectionWarning", resourceCulture); + } + } + /// /// Looks up a localized string similar to Creating Azure Dedicated Circuit with name {0} with service provider {1}. /// diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.resx b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.resx index be73b2626847..aa1a9d370254 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.resx +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Properties/Resources.resx @@ -195,4 +195,13 @@ A value for the VLan Id has to be provided. + + Provisioning Cross Connection for service key {0} + + + Successfully provisioned cross connection + + + Are you sure you want to provision a cross connection for service key {0}? + \ No newline at end of file diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config index 7905cfe9cb30..93792e1d661c 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/packages.config @@ -1,9 +1,9 @@  - - + + @@ -11,6 +11,6 @@ - + \ No newline at end of file diff --git a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj index 298408b8c4ec..47cac74d9ccd 100644 --- a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj +++ b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj @@ -50,15 +50,17 @@ ..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.dll False ..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.8-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + False + ..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.NetFramework.dll ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll @@ -117,8 +119,9 @@ False ..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll - - ..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.2-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll + + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.ExpressRoute.0.18.3-preview\lib\net40\Microsoft.WindowsAzure.Management.ExpressRoute.dll ..\..\..\packages\Microsoft.WindowsAzure.Management.MediaServices.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.MediaServices.dll @@ -315,6 +318,7 @@ Designer PreserveNewest + PreserveNewest diff --git a/src/ServiceManagement/Services/Commands.Test/packages.config b/src/ServiceManagement/Services/Commands.Test/packages.config index 6959bdf35c76..553b6ebc052b 100644 --- a/src/ServiceManagement/Services/Commands.Test/packages.config +++ b/src/ServiceManagement/Services/Commands.Test/packages.config @@ -1,7 +1,7 @@  - + @@ -18,7 +18,7 @@ - + From 6ebdab837b0c2af30f3f9d0bec6dbd1f92e3d986 Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Tue, 19 May 2015 16:35:44 -0700 Subject: [PATCH 02/10] Minor fixes to new crossconnection commandlets and AzureBgpPeering commandlets --- .../BgpPeerings/SetAzureBGPPeering.cs | 1 - .../Commands.ExpressRoute.csproj | 3 +++ .../CrossConnections/SetAzureCrossConnection.cs | 1 - .../Commands.ExpressRoute/ExpressRouteClient.cs | 13 +++++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs index cfd1717d48d2..689e792714d4 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs @@ -20,7 +20,6 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using ServiceManagement.Model; [Cmdlet(VerbsCommon.Set, "AzureBGPPeering"), OutputType(typeof(AzureBgpPeering))] public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj index 08314ab43a7b..ec2d8775b71a 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj @@ -122,6 +122,9 @@ + + + diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs index 7c02fb6795fc..223d2e9011dc 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs @@ -20,7 +20,6 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using ServiceManagement.Model; [Cmdlet(VerbsCommon.Set, "AzureCrossConnection"), OutputType(typeof(AzureCrossConnection))] public class SetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs index 3a6a4b28f34e..faeec58f6bb3 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs @@ -59,13 +59,16 @@ public AzureBgpPeering GetAzureBGPPeering(string serviceKey, BgpPeeringAccessTyp return Client.BorderGatewayProtocolPeerings.Get(serviceKey, accessType).BgpPeering; } - public AzureBgpPeering NewAzureBGPPeering(string serviceKey, UInt32 peerAsn, string primaryPeerSubnet, - string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null) + public AzureBgpPeering NewAzureBGPPeering(string serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, + string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null) { var result = Client.BorderGatewayProtocolPeerings.New(serviceKey, accessType, new BorderGatewayProtocolPeeringNewParameters() { + AdvertisedPublicPrefixes = advertisedPublicPrefixes, + CustomerAutonomousSystemNumber = customerAsn, PeerAutonomousSystemNumber = peerAsn, PrimaryPeerSubnet = primaryPeerSubnet, + RoutingRegistryName = routingRegistryName, SecondaryPeerSubnet = secondaryPeerSubnet, SharedKey = sharedKey, VirtualLanId = vlanId @@ -88,13 +91,15 @@ public bool RemoveAzureBGPPeering(string serviceKey, BgpPeeringAccessType access } public AzureBgpPeering UpdateAzureBGPPeering(string serviceKey, - BgpPeeringAccessType accessType, UInt32 peerAsn, string primaryPeerSubnet, - string secondaryPeerSubnet, UInt32 vlanId, string sharedKey) + BgpPeeringAccessType accessType, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, + string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, string sharedKey) { var result = Client.BorderGatewayProtocolPeerings.Update(serviceKey, accessType, new BorderGatewayProtocolPeeringUpdateParameters() { + CustomerAutonomousSystemNumber = customerAsn, PeerAutonomousSystemNumber = peerAsn, PrimaryPeerSubnet = primaryPeerSubnet, + RoutingRegistryName = routingRegistryName, SecondaryPeerSubnet = secondaryPeerSubnet, SharedKey = sharedKey, VirtualLanId = vlanId, From 54159672707dd9b8df6e34202d7427009588947f Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Tue, 19 May 2015 16:43:03 -0700 Subject: [PATCH 03/10] Minor Fixes --- .../CrossConnections/SetAzureCrossConnection.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs index 223d2e9011dc..5e17295ba4a8 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs @@ -36,11 +36,17 @@ public class SetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Provisioning Error Message")] public string ProvisioningError { get; set; } + [Parameter(Mandatory = false)] + public SwitchParameter PassThru { get; set; } + public override void ExecuteCmdlet() { var crossConnection = ExpressRouteClient.SetAzureCrossConnection(ServiceKey, new CrossConnectionUpdateParameters() {Operation = Operation, ProvisioningError = ProvisioningError}); - WriteObject(crossConnection); + if(PassThru.IsPresent) + { + WriteObject(crossConnection); + } } } } From 4369a37dfae845ae18f4811d209a8e378c24faa8 Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Tue, 2 Jun 2015 12:05:27 -0700 Subject: [PATCH 04/10] Removed app.config from Commands.Test.csproj --- .../Services/Commands.Test/Commands.Test.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj index 416bf39c1564..f56917e8ae06 100644 --- a/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj +++ b/src/ServiceManagement/Services/Commands.Test/Commands.Test.csproj @@ -318,7 +318,6 @@ Designer PreserveNewest - PreserveNewest From 834f6bbcaa8432f650f639831f14a3738faaa149 Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Thu, 4 Jun 2015 16:47:45 -0700 Subject: [PATCH 05/10] Fixing build errors --- setup/azurepowershell.sln | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/setup/azurepowershell.sln b/setup/azurepowershell.sln index a5d4bc722dc8..e6a17dd9f14a 100644 --- a/setup/azurepowershell.sln +++ b/setup/azurepowershell.sln @@ -1,7 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 -MinimumVisualStudioVersion = 10.0.40219.1 +# Visual Studio 2012 Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "azurepowershell", "azurepowershell.wixproj", "{36D6E303-E057-4963-A093-C7AAE0FD92B3}" ProjectSection(ProjectDependencies) = postProject {EA5BD11B-10B3-433D-A250-92AE76669D8D} = {EA5BD11B-10B3-433D-A250-92AE76669D8D} @@ -15,10 +13,8 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Release|Any CPU.Build.0 = Release|Any CPU + {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Debug|Any CPU.ActiveCfg = Debug|x86 + {36D6E303-E057-4963-A093-C7AAE0FD92B3}.Release|Any CPU.ActiveCfg = Release|x86 {EA5BD11B-10B3-433D-A250-92AE76669D8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EA5BD11B-10B3-433D-A250-92AE76669D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU {EA5BD11B-10B3-433D-A250-92AE76669D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU From 87cd113160361a915cec661e86ac7aa4e189ddf9 Mon Sep 17 00:00:00 2001 From: ogail Date: Mon, 8 Jun 2015 11:33:57 -0700 Subject: [PATCH 06/10] Move SQL tests to post check-in tests --- .../ScenarioTests/DataMaskingTests.cs | 5 +---- .../ScenarioTests/SecurityTests.cs | 14 -------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs index 19bfca80a5bc..fcf5f23e260e 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs @@ -27,9 +27,8 @@ public void TestDatabaseDataMaskingPolicyEnablementToggling() RunPowerShellTest("Test-DatabaseDataMaskingPolicyEnablementToggling"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseDataMaskingLevelChanges() { RunPowerShellTest("Test-DatabaseDataMaskingLevelChanges"); @@ -63,9 +62,7 @@ public void TestDatabaseDataMaskingTextRuleLifecycle() RunPowerShellTest("Test-DatabaseDataMaskingTextRuleLifecycle"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseDataMaskingRuleCreationFailures() { RunPowerShellTest("Test-DatabaseDataMaskingRuleCreationFailures"); diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs index b4a6cc906d87..d1ef0f7cc4a6 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs @@ -26,24 +26,18 @@ public void TestDatabaseUpdatePolicyWithStorage() RunPowerShellTest("Test-DatabaseUpdatePolicyWithStorage"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithStorage() { RunPowerShellTest("Test-ServerUpdatePolicyWithStorage"); } - [Fact(Skip = "Test executes for long time period")] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseUpdatePolicyWithEventTypes() { RunPowerShellTest("Test-DatabaseUpdatePolicyWithEventTypes"); } - [Fact(Skip = "Skip for the version header upgrade on Storage library.")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithEventTypes() { RunPowerShellTest("Test-ServerUpdatePolicyWithEventTypes"); @@ -184,33 +178,25 @@ public void TestServerStorageKeyRotation() RunPowerShellTest("Test-ServerStorageKeyRotation"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithRetention() { RunPowerShellTest("Test-ServerUpdatePolicyWithRetention"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseUpdatePolicyWithRetention() { RunPowerShellTest("Test-DatabaseUpdatePolicyWithRetention"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerRetentionKeepProperties() { RunPowerShellTest("Test-ServerRetentionKeepProperties"); } - [Fact(Skip = "Test executes for long time period")] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseRetentionKeepProperties() { RunPowerShellTest("Test-DatabaseRetentionKeepProperties"); From 71b53763871ac77ef4979d09c0db9e5b71a1b878 Mon Sep 17 00:00:00 2001 From: ogail Date: Mon, 8 Jun 2015 11:33:57 -0700 Subject: [PATCH 07/10] Move SQL tests to post check-in tests --- .../ScenarioTests/DataMaskingTests.cs | 6 ++---- .../ScenarioTests/SecurityTests.cs | 21 +++++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs index 19bfca80a5bc..d1f53b053566 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/DataMaskingTests.cs @@ -27,9 +27,8 @@ public void TestDatabaseDataMaskingPolicyEnablementToggling() RunPowerShellTest("Test-DatabaseDataMaskingPolicyEnablementToggling"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseDataMaskingLevelChanges() { RunPowerShellTest("Test-DatabaseDataMaskingLevelChanges"); @@ -63,9 +62,8 @@ public void TestDatabaseDataMaskingTextRuleLifecycle() RunPowerShellTest("Test-DatabaseDataMaskingTextRuleLifecycle"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseDataMaskingRuleCreationFailures() { RunPowerShellTest("Test-DatabaseDataMaskingRuleCreationFailures"); diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs index b4a6cc906d87..40ec5b7ed611 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SecurityTests.cs @@ -26,24 +26,21 @@ public void TestDatabaseUpdatePolicyWithStorage() RunPowerShellTest("Test-DatabaseUpdatePolicyWithStorage"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithStorage() { RunPowerShellTest("Test-ServerUpdatePolicyWithStorage"); } - [Fact(Skip = "Test executes for long time period")] - [Trait(Category.AcceptanceType, Category.CheckIn)] + [Fact] public void TestDatabaseUpdatePolicyWithEventTypes() { RunPowerShellTest("Test-DatabaseUpdatePolicyWithEventTypes"); } - [Fact(Skip = "Skip for the version header upgrade on Storage library.")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithEventTypes() { RunPowerShellTest("Test-ServerUpdatePolicyWithEventTypes"); @@ -184,33 +181,29 @@ public void TestServerStorageKeyRotation() RunPowerShellTest("Test-ServerStorageKeyRotation"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerUpdatePolicyWithRetention() { RunPowerShellTest("Test-ServerUpdatePolicyWithRetention"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseUpdatePolicyWithRetention() { RunPowerShellTest("Test-DatabaseUpdatePolicyWithRetention"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestServerRetentionKeepProperties() { RunPowerShellTest("Test-ServerRetentionKeepProperties"); } - [Fact(Skip = "Test executes for long time period")] + [Fact] [Trait(Category.RunType, Category.LiveOnly)] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDatabaseRetentionKeepProperties() { RunPowerShellTest("Test-DatabaseRetentionKeepProperties"); From c35d55618c3cfaeb59430a1219c66b1c509633a0 Mon Sep 17 00:00:00 2001 From: ogail Date: Mon, 8 Jun 2015 12:17:14 -0700 Subject: [PATCH 08/10] Move TestMoveAResourceTest to post-checkin --- .../Commands.Resources.Test/ScenarioTests/ResourceTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.cs index c379bed1874d..b57653da05ea 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourceTests.cs @@ -77,7 +77,6 @@ public void TestGetResourcesViaPipingFromAnotherResource() } [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestMoveAResourceTest() { ResourcesController.NewInstance.RunPsTest("Test-MoveAResource"); From 7071e981c9e2d1d19913c93e09c1d51e6e6854bc Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Mon, 8 Jun 2015 16:56:08 -0700 Subject: [PATCH 09/10] Converting ServiceKey and AuthorizationId to Guid --- setup/azurepowershell.sln | 6 +- .../GetAzureAuthorizedDedicatedCircuit.cs | 13 ++- .../BgpPeerings/GetAzureBGPPeering.cs | 6 +- .../BgpPeerings/NewAzureBGPPeering.cs | 4 +- .../BgpPeerings/RemoveAzureBGPPeering.cs | 6 +- .../BgpPeerings/SetAzureBGPPeering.cs | 4 +- .../GetAzureCrossConnection.cs | 8 +- .../NewAzureCrossConnections.cs | 6 +- .../SetAzureCrossConnection.cs | 15 ++- ...tedCircuitLinkAuthorizationMicrosoftIds.cs | 16 ++-- ...tedCircuitLinkAuthorizationMicrosoftIds.cs | 16 ++-- ...tAzureDedicatedCircuitLinkAuthorization.cs | 17 ++-- ...wAzureDedicatedCircuitLinkAuthorization.cs | 9 +- ...eAzureDedicatedCircuitLinkAuthorization.cs | 8 +- ...tAzureDedicatedCircuitLinkAuthorization.cs | 12 +-- .../GetAzureDedicatedCircuitLink.cs | 6 +- .../NewAzureDedicatedCircuitLink.cs | 6 +- .../RemoveAzureDedicatedCircuitLink.cs | 4 +- .../SetAzureDedicatedCircuitProperties.cs | 6 +- .../GetAzureDedicatedCircuit.cs | 8 +- .../RemoveAzureDedicatedCircuit.cs | 6 +- .../ExpressRouteClient.cs | 91 ++++++++++--------- .../ExpressRoute/AzureBgpPeeringTests.cs | 6 +- .../AzureDedicatedCircuitLinkTests.cs | 8 +- .../AzureDedicatedCircuitTests.cs | 4 +- 25 files changed, 131 insertions(+), 160 deletions(-) diff --git a/setup/azurepowershell.sln b/setup/azurepowershell.sln index e6a17dd9f14a..f76d149c204c 100644 --- a/setup/azurepowershell.sln +++ b/setup/azurepowershell.sln @@ -1,5 +1,7 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30110.0 +MinimumVisualStudioVersion = 10.0.40219.1 + Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "azurepowershell", "azurepowershell.wixproj", "{36D6E303-E057-4963-A093-C7AAE0FD92B3}" ProjectSection(ProjectDependencies) = postProject {EA5BD11B-10B3-433D-A250-92AE76669D8D} = {EA5BD11B-10B3-433D-A250-92AE76669D8D} diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/AuthorizedDedicatedCircuits/GetAzureAuthorizedDedicatedCircuit.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/AuthorizedDedicatedCircuits/GetAzureAuthorizedDedicatedCircuit.cs index 7b70895acd0b..b3e2f08f258e 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/AuthorizedDedicatedCircuits/GetAzureAuthorizedDedicatedCircuit.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/AuthorizedDedicatedCircuits/GetAzureAuthorizedDedicatedCircuit.cs @@ -12,25 +12,24 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System.Collections.Generic; +using System.Management.Automation; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using Microsoft.WindowsAzure.Management.ExpressRoute.Models; - using System.Collections.Generic; - using System.Management.Automation; [Cmdlet(VerbsCommon.Get, "AzureAuthorizedDedicatedCircuit"), OutputType(typeof(AzureAuthorizedDedicatedCircuit), typeof(IEnumerable))] public class GetAzureAuthorizedDedicatedCircuitCommand : ExpressRouteBaseCmdlet { [Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Dedicated Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } public override void ExecuteCmdlet() { - if (!string.IsNullOrEmpty(ServiceKey)) + if (ServiceKey != Guid.Empty) { GetByServiceKey(); } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/GetAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/GetAzureBGPPeering.cs index 48d26f623267..b4dd9f1a5e1e 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/GetAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/GetAzureBGPPeering.cs @@ -15,17 +15,17 @@ using System.ComponentModel; using System.Management.Automation; using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + [Cmdlet(VerbsCommon.Get, "AzureBGPPeering"), OutputType(typeof(AzureBgpPeering))] public class GetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Public or Private")] [DefaultValue("Private")] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs index 97f2b4d3e3a6..a0ce990977e6 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/NewAzureBGPPeering.cs @@ -23,9 +23,7 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute public class NewAzureBGPPeeringCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit for which BGP peering needs to be created/modified")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Advertised Public Prefixes")] [ValidateNotNullOrEmpty] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/RemoveAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/RemoveAzureBGPPeering.cs index 4b5ecc57aaf0..8b2184186a81 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/RemoveAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/RemoveAzureBGPPeering.cs @@ -25,9 +25,7 @@ public class RemoveAzureBGPPeeringCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key associated with the Azure BGP Peering to be removed")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Bgp Peering Access Type: Public or Private")] [DefaultValue("Private")] @@ -45,7 +43,7 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format(Resources.RemoveAzureBGPPeeringWarning, ServiceKey), Resources.RemoveAzureBGPPeeringMessage, - ServiceKey, + ServiceKey.ToString(), () => { diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs index 689e792714d4..56d76cab4efe 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/BgpPeerings/SetAzureBGPPeering.cs @@ -25,9 +25,7 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute public class SetAzureBGPPeeringCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit for which BGP peering needs to be created/modified")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Advertised Public Prefixes")] [ValidateNotNullOrEmpty] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs index e24cd92d57e9..8e86113c7d7c 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/GetAzureCrossConnection.cs @@ -19,18 +19,18 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + using System; + [Cmdlet(VerbsCommon.Get, "AzureCrossConnection"), OutputType(typeof(AzureCrossConnection), typeof(IEnumerable))] public class GetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet { [Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Dedicated Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } public override void ExecuteCmdlet() { - if (!string.IsNullOrEmpty(ServiceKey)) + if(ServiceKey != Guid.Empty) { GetByServiceKey(); } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs index c65d924523cc..a9cb80c6d980 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/NewAzureCrossConnections.cs @@ -24,9 +24,7 @@ public class NewAzureCrossConnectionCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Dedicated Circuit Service Key")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(HelpMessage = "Do not confirm Azure Cross Connection creation")] public SwitchParameter Force { get; set; } @@ -37,7 +35,7 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format(Resources.NewAzureCrossConnectionWarning, ServiceKey), string.Format(Resources.NewAzureCrossConnectionMessage, ServiceKey), - ServiceKey, + ServiceKey.ToString(), () => { var crossConnection = ExpressRouteClient.NewAzureCrossConnection(ServiceKey); diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs index 5e17295ba4a8..2c161e80ff8f 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/CrossConnections/SetAzureCrossConnection.cs @@ -25,9 +25,7 @@ namespace Microsoft.WindowsAzure.Commands.ExpressRoute public class SetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit for which BGP peering needs to be created/modified")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Notification Operation to perform. NotifyCrossConnectionProvisioned or NotifyCrossConnectionNotProvisioned")] [ValidateNotNullOrEmpty] @@ -36,17 +34,16 @@ public class SetAzureCrossConnectionCommand : ExpressRouteBaseCmdlet [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Provisioning Error Message")] public string ProvisioningError { get; set; } - [Parameter(Mandatory = false)] + [Parameter(Mandatory = false)] public SwitchParameter PassThru { get; set; } public override void ExecuteCmdlet() { - var crossConnection = ExpressRouteClient.SetAzureCrossConnection(ServiceKey, - new CrossConnectionUpdateParameters() {Operation = Operation, ProvisioningError = ProvisioningError}); + var crossConnection = ExpressRouteClient.SetAzureCrossConnection(ServiceKey, new CrossConnectionUpdateParameters() {Operation = Operation, ProvisioningError = ProvisioningError}); if(PassThru.IsPresent) - { - WriteObject(crossConnection); - } + { + WriteObject(crossConnection); + } } } } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs index 02d621b27106..2e066a66c95f 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs @@ -12,24 +12,22 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System.Management.Automation; + namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using Microsoft.WindowsAzure.Management.ExpressRoute.Models; - using System.Management.Automation; - + [Cmdlet(VerbsCommon.New, "AzureDedicatedCircuitLinkAuthorizationMicrosoftIds")] public class NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIdsCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Authorization Id")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string AuthorizationId { get; set; } + public Guid AuthorizationId { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Microsoft Ids to be removed")] public string MicrosoftIds { get; set; } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs index bb3a59de7f01..106a59bcf581 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizationMicrosoftIds/RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds.cs @@ -12,24 +12,22 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System.Management.Automation; + namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using Microsoft.WindowsAzure.Management.ExpressRoute.Models; - using System.Management.Automation; - + [Cmdlet(VerbsCommon.Remove, "AzureDedicatedCircuitLinkAuthorizationMicrosoftIds")] public class RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIdsCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Authorization Id")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string AuthorizationId { get; set; } + public Guid AuthorizationId { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Microsoft Ids to be removed")] public string MicrosoftIds { get; set; } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/GetAzureDedicatedCircuitLinkAuthorization.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/GetAzureDedicatedCircuitLinkAuthorization.cs index 85312f21bc55..1429ab7ffd21 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/GetAzureDedicatedCircuitLinkAuthorization.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/GetAzureDedicatedCircuitLinkAuthorization.cs @@ -12,29 +12,26 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System.Management.Automation; + namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using Microsoft.WindowsAzure.Management.ExpressRoute.Models; - using System.Management.Automation; - [Cmdlet(VerbsCommon.Get, "AzureDedicatedCircuitLinkAuthorization"), OutputType(typeof(AzureDedicatedCircuitLinkAuthorization))] public class GetAzureDedicatedCircuitLinkAuthorizationCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Azure Dedicated Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Authorization Id")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string AuthorizationId { get; set; } + public Guid AuthorizationId { get; set; } public override void ExecuteCmdlet() { - if (!string.IsNullOrEmpty(AuthorizationId)) + if (AuthorizationId != Guid.Empty) { GetByAuthorizationId(); } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/NewAzureDedicatedCircuitLinkAuthorization.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/NewAzureDedicatedCircuitLinkAuthorization.cs index 9b38f1f2a4e2..a2fa064b47e3 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/NewAzureDedicatedCircuitLinkAuthorization.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/NewAzureDedicatedCircuitLinkAuthorization.cs @@ -12,19 +12,18 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System.Management.Automation; +using System; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using Microsoft.WindowsAzure.Management.ExpressRoute.Models; - using System.Management.Automation; [Cmdlet(VerbsCommon.New, "AzureDedicatedCircuitLinkAuthorization"), OutputType(typeof(AzureDedicatedCircuitLinkAuthorization))] public class NewAzureDedicatedCircuitLinkAuthorizationCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Description")] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/RemoveAzureDedicatedCircuitLinkAuthorization.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/RemoveAzureDedicatedCircuitLinkAuthorization.cs index 57a89ac34939..3b7c800ea2d9 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/RemoveAzureDedicatedCircuitLinkAuthorization.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/RemoveAzureDedicatedCircuitLinkAuthorization.cs @@ -23,15 +23,11 @@ public class RemoveAzureDedicatedCircuitLinkAuthorizationCommand : ExpressRouteB { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key for the Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Authorization Id")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string AuthorizationId { get; set; } + public Guid AuthorizationId { get; set; } [Parameter(HelpMessage = "Do not confirm")] public SwitchParameter Force { get; set; } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/SetAzureDedicatedCircuitLinkAuthorization.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/SetAzureDedicatedCircuitLinkAuthorization.cs index 5f328865ef74..1e0a1332003d 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/SetAzureDedicatedCircuitLinkAuthorization.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinkAuthorizations/SetAzureDedicatedCircuitLinkAuthorization.cs @@ -12,24 +12,22 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System; +using System.Management.Automation; + namespace Microsoft.WindowsAzure.Commands.ExpressRoute { - using System.Management.Automation; [Cmdlet(VerbsCommon.Set, "AzureDedicatedCircuitLinkAuthorization"), OutputType(typeof(bool))] public class SetAzureDedicatedCircuitLinkAuthorizationAuthorizationCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key for the Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Authorization Id")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string AuthorizationId { get; set; } + public Guid AuthorizationId { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Description")] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/GetAzureDedicatedCircuitLink.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/GetAzureDedicatedCircuitLink.cs index 03e0fd0a9073..fc057bcf01ba 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/GetAzureDedicatedCircuitLink.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/GetAzureDedicatedCircuitLink.cs @@ -14,17 +14,17 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + [Cmdlet(VerbsCommon.Get, "AzureDedicatedCircuitLink"), OutputType(typeof(AzureDedicatedCircuitLink))] public class GetAzureDedicatedCircuitLinkCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Azure Dedicated Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Vnet Name")] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/NewAzureDedicatedCircuitLink.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/NewAzureDedicatedCircuitLink.cs index dcc00c943938..212ec2e62b60 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/NewAzureDedicatedCircuitLink.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/NewAzureDedicatedCircuitLink.cs @@ -14,17 +14,17 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + [Cmdlet(VerbsCommon.New, "AzureDedicatedCircuitLink"), OutputType(typeof(AzureDedicatedCircuitLink))] public class NewAzureDedicatedCircuitLinkCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing Azure Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Virtual Network Name")] [ValidateNotNullOrEmpty] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/RemoveAzureDedicatedCircuitLink.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/RemoveAzureDedicatedCircuitLink.cs index 2dc790d26043..b6c892b357c1 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/RemoveAzureDedicatedCircuitLink.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitLinks/RemoveAzureDedicatedCircuitLink.cs @@ -23,9 +23,7 @@ public class RemoveAzureDedicatedCircuitLinkCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key for the Azure Circuit Vnet Mapping to be removed")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Virtual Network Name for the Azure Circuit Vnet Mapping to be removed")] diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitProperties/SetAzureDedicatedCircuitProperties.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitProperties/SetAzureDedicatedCircuitProperties.cs index cdb5c7af687b..ebd773f46c3c 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitProperties/SetAzureDedicatedCircuitProperties.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuitProperties/SetAzureDedicatedCircuitProperties.cs @@ -25,9 +25,7 @@ public class SetAzureDedicatedCircuitPropertiesCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key of Azure Dedicated Circuit to be removed")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Circuit Bandwidth")] public UInt32? Bandwidth { get; set; } @@ -44,7 +42,7 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format(Resources.SetAzureDedicatedCircuitBandwidthWarning, ServiceKey, Bandwidth), Resources.SetAzureDedicatedCircuitBandwidthMessage, - ServiceKey, + ServiceKey.ToString(), () => { var circuit = ExpressRouteClient.SetAzureDedicatedCircuitProperties(ServiceKey, Bandwidth, Sku); diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/GetAzureDedicatedCircuit.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/GetAzureDedicatedCircuit.cs index 10f439148792..ee183d41b9b0 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/GetAzureDedicatedCircuit.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/GetAzureDedicatedCircuit.cs @@ -16,21 +16,21 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.WindowsAzure.Management.ExpressRoute.Models; +using System; namespace Microsoft.WindowsAzure.Commands.ExpressRoute { + [Cmdlet(VerbsCommon.Get, "AzureDedicatedCircuit"), OutputType(typeof(AzureDedicatedCircuit), typeof (IEnumerable))] public class GetAzureDedicatedCircuitCommand : ExpressRouteBaseCmdlet { [Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key representing the Dedicated Circuit")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } public override void ExecuteCmdlet() { - if (!string.IsNullOrEmpty(ServiceKey)) + if (ServiceKey != Guid.Empty) { GetByServiceKey(); } diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/RemoveAzureDedicatedCircuit.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/RemoveAzureDedicatedCircuit.cs index 5f82d967a6f3..2ef18f852f90 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/RemoveAzureDedicatedCircuit.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/DedicatedCircuits/RemoveAzureDedicatedCircuit.cs @@ -23,9 +23,7 @@ public class RemoveAzureDedicatedCircuitCommand : ExpressRouteBaseCmdlet { [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Service Key of Azure Dedicated Circuit to be removed")] - [ValidateGuid] - [ValidateNotNullOrEmpty] - public string ServiceKey { get; set; } + public Guid ServiceKey { get; set; } [Parameter(HelpMessage = "Do not confirm Azure Dedicated Circuit deletion")] public SwitchParameter Force { get; set; } @@ -39,7 +37,7 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format(Resources.RemoveAzureDedicatdCircuitWarning, ServiceKey), Resources.RemoveAzureDedicatedCircuitMessage, - ServiceKey, + ServiceKey.ToString(), () => { if (!ExpressRouteClient.RemoveAzureDedicatedCircuit(ServiceKey)) diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs index faeec58f6bb3..60b7d3b94249 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRouteClient.cs @@ -44,6 +44,7 @@ private static ClientType CreateClient(AzureProfile profile, AzureSu /// Creates new ExpressRouteClient /// /// Subscription containing websites to manipulate + /// Azure Profile public ExpressRouteClient(AzureProfile profile, AzureSubscription subscription) : this(CreateClient(profile, subscription)) { @@ -54,15 +55,15 @@ public ExpressRouteClient(ExpressRouteManagementClient client) Client = client; } - public AzureBgpPeering GetAzureBGPPeering(string serviceKey, BgpPeeringAccessType accessType) + public AzureBgpPeering GetAzureBGPPeering(Guid serviceKey, BgpPeeringAccessType accessType) { - return Client.BorderGatewayProtocolPeerings.Get(serviceKey, accessType).BgpPeering; + return Client.BorderGatewayProtocolPeerings.Get(serviceKey.ToString(), accessType).BgpPeering; } - public AzureBgpPeering NewAzureBGPPeering(string serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, + public AzureBgpPeering NewAzureBGPPeering(Guid serviceKey, string advertisedPublicPrefixes, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, BgpPeeringAccessType accessType, string sharedKey = null) { - var result = Client.BorderGatewayProtocolPeerings.New(serviceKey, accessType, new BorderGatewayProtocolPeeringNewParameters() + var result = Client.BorderGatewayProtocolPeerings.New(serviceKey.ToString(), accessType, new BorderGatewayProtocolPeeringNewParameters() { AdvertisedPublicPrefixes = advertisedPublicPrefixes, CustomerAutonomousSystemNumber = customerAsn, @@ -84,17 +85,17 @@ public AzureBgpPeering NewAzureBGPPeering(string serviceKey, string advertisedPu } } - public bool RemoveAzureBGPPeering(string serviceKey, BgpPeeringAccessType accessType) + public bool RemoveAzureBGPPeering(Guid serviceKey, BgpPeeringAccessType accessType) { - var result = Client.BorderGatewayProtocolPeerings.Remove(serviceKey, accessType); + var result = Client.BorderGatewayProtocolPeerings.Remove(serviceKey.ToString(), accessType); return result.HttpStatusCode.Equals(HttpStatusCode.OK); } - public AzureBgpPeering UpdateAzureBGPPeering(string serviceKey, + public AzureBgpPeering UpdateAzureBGPPeering(Guid serviceKey, BgpPeeringAccessType accessType, UInt32 customerAsn, UInt32 peerAsn, string primaryPeerSubnet, string routingRegistryName, string secondaryPeerSubnet, UInt32 vlanId, string sharedKey) { - var result = Client.BorderGatewayProtocolPeerings.Update(serviceKey, accessType, new BorderGatewayProtocolPeeringUpdateParameters() + var result = Client.BorderGatewayProtocolPeerings.Update(serviceKey.ToString(), accessType, new BorderGatewayProtocolPeeringUpdateParameters() { CustomerAutonomousSystemNumber = customerAsn, PeerAutonomousSystemNumber = peerAsn, @@ -114,9 +115,9 @@ public AzureBgpPeering UpdateAzureBGPPeering(string serviceKey, } } - public AzureDedicatedCircuit GetAzureDedicatedCircuit(string serviceKey) + public AzureDedicatedCircuit GetAzureDedicatedCircuit(Guid serviceKey) { - return (Client.DedicatedCircuits.Get(serviceKey)).DedicatedCircuit; + return (Client.DedicatedCircuits.Get(serviceKey.ToString())).DedicatedCircuit; } public AzureDedicatedCircuit NewAzureDedicatedCircuit(string circuitName, @@ -133,7 +134,7 @@ public AzureDedicatedCircuit NewAzureDedicatedCircuit(string circuitName, if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) { - return GetAzureDedicatedCircuit(result.Data); + return GetAzureDedicatedCircuit(new Guid(result.Data)); } else { @@ -146,7 +147,7 @@ public IEnumerable ListAzureDedicatedCircuit() return (Client.DedicatedCircuits.List().DedicatedCircuits); } - public AzureDedicatedCircuit SetAzureDedicatedCircuitProperties(string serviceKey, UInt32? bandwidth, CircuitSku? sku) + public AzureDedicatedCircuit SetAzureDedicatedCircuitProperties(Guid serviceKey, UInt32? bandwidth, CircuitSku? sku) { var updateParams = new DedicatedCircuitUpdateParameters() {}; @@ -160,7 +161,7 @@ public AzureDedicatedCircuit SetAzureDedicatedCircuitProperties(string serviceKe updateParams.Sku = sku.Value.ToString(); } - var result = Client.DedicatedCircuits.Update(serviceKey, updateParams); + var result = Client.DedicatedCircuits.Update(serviceKey.ToString(), updateParams); if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) { @@ -172,20 +173,20 @@ public AzureDedicatedCircuit SetAzureDedicatedCircuitProperties(string serviceKe } } - public bool RemoveAzureDedicatedCircuit(string serviceKey) + public bool RemoveAzureDedicatedCircuit(Guid serviceKey) { - var result = Client.DedicatedCircuits.Remove(serviceKey); + var result = Client.DedicatedCircuits.Remove(serviceKey.ToString()); return result.HttpStatusCode.Equals(HttpStatusCode.OK); } - public AzureDedicatedCircuitLink GetAzureDedicatedCircuitLink(string serviceKey, string vNetName) + public AzureDedicatedCircuitLink GetAzureDedicatedCircuitLink(Guid serviceKey, string vNetName) { - return (Client.DedicatedCircuitLinks.Get(serviceKey, vNetName)).DedicatedCircuitLink; + return (Client.DedicatedCircuitLinks.Get(serviceKey.ToString(), vNetName)).DedicatedCircuitLink; } - public AzureDedicatedCircuitLink NewAzureDedicatedCircuitLink(string serviceKey, string vNetName) + public AzureDedicatedCircuitLink NewAzureDedicatedCircuitLink(Guid serviceKey, string vNetName) { - var result = Client.DedicatedCircuitLinks.New(serviceKey, vNetName); + var result = Client.DedicatedCircuitLinks.New(serviceKey.ToString(), vNetName); if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) { return GetAzureDedicatedCircuitLink(serviceKey, vNetName); @@ -196,14 +197,14 @@ public AzureDedicatedCircuitLink NewAzureDedicatedCircuitLink(string serviceKey, } } - public IEnumerable ListAzureDedicatedCircuitLink(string serviceKey) + public IEnumerable ListAzureDedicatedCircuitLink(Guid serviceKey) { - return (Client.DedicatedCircuitLinks.List(serviceKey).DedicatedCircuitLinks); + return (Client.DedicatedCircuitLinks.List(serviceKey.ToString()).DedicatedCircuitLinks); } - public bool RemoveAzureDedicatedCircuitLink(string serviceKey, string vNetName) + public bool RemoveAzureDedicatedCircuitLink(Guid serviceKey, string vNetName) { - var result = Client.DedicatedCircuitLinks.Remove(serviceKey, vNetName); + var result = Client.DedicatedCircuitLinks.Remove(serviceKey.ToString(), vNetName); return result.HttpStatusCode.Equals(HttpStatusCode.OK); } @@ -212,14 +213,14 @@ public IEnumerable ListAzureDedicatedCircu return (Client.DedicatedCircuitServiceProviders.List().DedicatedCircuitServiceProviders); } - public AzureCrossConnection GetAzureCrossConnection(string serviceKey) + public AzureCrossConnection GetAzureCrossConnection(Guid serviceKey) { - return (Client.CrossConnections.Get(serviceKey)).CrossConnection; + return (Client.CrossConnections.Get(serviceKey.ToString())).CrossConnection; } - public AzureCrossConnection NewAzureCrossConnection(string serviceKey) + public AzureCrossConnection NewAzureCrossConnection(Guid serviceKey) { - var result = Client.CrossConnections.New(serviceKey); + var result = Client.CrossConnections.New(serviceKey.ToString()); if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) { @@ -231,10 +232,10 @@ public AzureCrossConnection NewAzureCrossConnection(string serviceKey) } } - public AzureCrossConnection SetAzureCrossConnection(string serviceKey, + public AzureCrossConnection SetAzureCrossConnection(Guid serviceKey, CrossConnectionUpdateParameters parameters) { - var result = Client.CrossConnections.Update(serviceKey, parameters); + var result = Client.CrossConnections.Update(serviceKey.ToString(), parameters); if (result.HttpStatusCode.Equals(HttpStatusCode.OK)) { @@ -251,14 +252,14 @@ public IEnumerable ListAzureCrossConnections() return (Client.CrossConnections.List()).CrossConnections; } - public AzureDedicatedCircuitLinkAuthorization GetAzureDedicatedCircuitLinkAuthorization(string serviceKey, string authorizationId) + public AzureDedicatedCircuitLinkAuthorization GetAzureDedicatedCircuitLinkAuthorization(Guid serviceKey, Guid authorizationId) { - return (Client.DedicatedCircuitLinkAuthorizations.Get(serviceKey, authorizationId)).DedicatedCircuitLinkAuthorization; + return (Client.DedicatedCircuitLinkAuthorizations.Get(serviceKey.ToString(), authorizationId.ToString())).DedicatedCircuitLinkAuthorization; } - public AzureDedicatedCircuitLinkAuthorization NewAzureDedicatedCircuitLinkAuthorization(string serviceKey, string description, int limit, string microsoftIds) + public AzureDedicatedCircuitLinkAuthorization NewAzureDedicatedCircuitLinkAuthorization(Guid serviceKey, string description, int limit, string microsoftIds) { - return (Client.DedicatedCircuitLinkAuthorizations.New(serviceKey, new DedicatedCircuitLinkAuthorizationNewParameters() + return (Client.DedicatedCircuitLinkAuthorizations.New(serviceKey.ToString(), new DedicatedCircuitLinkAuthorizationNewParameters() { Description = description, Limit = limit, @@ -266,29 +267,29 @@ public AzureDedicatedCircuitLinkAuthorization NewAzureDedicatedCircuitLinkAuthor })).DedicatedCircuitLinkAuthorization; } - public AzureDedicatedCircuitLinkAuthorization SetAzureDedicatedCircuitLinkAuthorization(string serviceKey, string authorizationId, string description, int limit) + public AzureDedicatedCircuitLinkAuthorization SetAzureDedicatedCircuitLinkAuthorization(Guid serviceKey, Guid authorizationId, string description, int limit) { - return (Client.DedicatedCircuitLinkAuthorizations.Update(serviceKey, authorizationId, new DedicatedCircuitLinkAuthorizationUpdateParameters() + return (Client.DedicatedCircuitLinkAuthorizations.Update(serviceKey.ToString(), authorizationId.ToString(), new DedicatedCircuitLinkAuthorizationUpdateParameters() { Description = description, Limit = limit })).DedicatedCircuitLinkAuthorization; } - public IEnumerable ListAzureDedicatedCircuitLinkAuthorizations(string serviceKey) + public IEnumerable ListAzureDedicatedCircuitLinkAuthorizations(Guid serviceKey) { - return (Client.DedicatedCircuitLinkAuthorizations.List(serviceKey).DedicatedCircuitLinkAuthorizations); + return (Client.DedicatedCircuitLinkAuthorizations.List(serviceKey.ToString()).DedicatedCircuitLinkAuthorizations); } - public bool RemoveAzureDedicatedCircuitLinkAuthorization(string serviceKey, string authorizationId) + public bool RemoveAzureDedicatedCircuitLinkAuthorization(Guid serviceKey, Guid authorizationId) { - var result = Client.DedicatedCircuitLinkAuthorizations.Remove(serviceKey, authorizationId); + var result = Client.DedicatedCircuitLinkAuthorizations.Remove(serviceKey.ToString(), authorizationId.ToString()); return result.HttpStatusCode.Equals(HttpStatusCode.OK); } - public AzureAuthorizedDedicatedCircuit GetAuthorizedAzureDedicatedCircuit(string serviceKey) + public AzureAuthorizedDedicatedCircuit GetAuthorizedAzureDedicatedCircuit(Guid serviceKey) { - return (Client.AuthorizedDedicatedCircuits.Get(serviceKey)).AuthorizedDedicatedCircuit; + return (Client.AuthorizedDedicatedCircuits.Get(serviceKey.ToString())).AuthorizedDedicatedCircuit; } public IEnumerable ListAzureAuthorizedDedicatedCircuits() @@ -296,18 +297,18 @@ public IEnumerable ListAzureAuthorizedDedicated return (Client.AuthorizedDedicatedCircuits.List().AuthorizedDedicatedCircuits); } - public bool NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(string serviceKey, string authorizationId, string microsoftIds) + public bool NewAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(Guid serviceKey, Guid authorizationId, string microsoftIds) { - var result = Client.DedicatedCircuitLinkAuthorizationMicrosoftIds.New(serviceKey, authorizationId, new DedicatedCircuitLinkAuthorizationMicrosoftIdNewParameters() + var result = Client.DedicatedCircuitLinkAuthorizationMicrosoftIds.New(serviceKey.ToString(), authorizationId.ToString(), new DedicatedCircuitLinkAuthorizationMicrosoftIdNewParameters() { MicrosoftIds = microsoftIds }); return result.StatusCode.Equals(HttpStatusCode.OK); } - public bool RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(string serviceKey, string authorizationId, string microsoftIds) + public bool RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(Guid serviceKey, Guid authorizationId, string microsoftIds) { - var result = Client.DedicatedCircuitLinkAuthorizationMicrosoftIds.Remove(serviceKey, authorizationId, new DedicatedCircuitLinkAuthorizationMicrosoftIdRemoveParameters() + var result = Client.DedicatedCircuitLinkAuthorizationMicrosoftIds.Remove(serviceKey.ToString(), authorizationId.ToString(), new DedicatedCircuitLinkAuthorizationMicrosoftIdRemoveParameters() { MicrosoftIds = microsoftIds }); diff --git a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureBgpPeeringTests.cs b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureBgpPeeringTests.cs index 58adc31e603b..92c8171d367f 100644 --- a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureBgpPeeringTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureBgpPeeringTests.cs @@ -116,7 +116,7 @@ public void NewAzureBgpPeeringSuccessful() NewAzureBGPPeeringCommand cmdlet = new NewAzureBGPPeeringCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), AccessType = accessType, PeerAsn = peerAsn, PrimaryPeerSubnet = primaryPeerSubnet, @@ -187,7 +187,7 @@ public void GetAzureBgpPeeringSuccessful() GetAzureBGPPeeringCommand cmdlet = new GetAzureBGPPeeringCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), AccessType = accessType, CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) @@ -232,7 +232,7 @@ public void RemoveAzureBgpPeeringSuccessful() RemoveAzureBGPPeeringCommand cmdlet = new RemoveAzureBGPPeeringCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), AccessType = accessType, CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) diff --git a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitLinkTests.cs b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitLinkTests.cs index bbf1336e5fce..eed2ed04403c 100644 --- a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitLinkTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitLinkTests.cs @@ -84,7 +84,7 @@ public void NewAzureDedicatedCircuitLinkSuccessful() NewAzureDedicatedCircuitLinkCommand cmdlet = new NewAzureDedicatedCircuitLinkCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), VNetName = vNetName, CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) @@ -130,7 +130,7 @@ public void GetAzureDedicatedCircuitLinkSuccessful() GetAzureDedicatedCircuitLinkCommand cmdlet = new GetAzureDedicatedCircuitLinkCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), VNetName = vNetName, CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) @@ -170,7 +170,7 @@ public void RemoveAzureDedicatedCircuitLinkSuccessful() RemoveAzureDedicatedCircuitLinkCommand cmdlet = new RemoveAzureDedicatedCircuitLinkCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), VNetName = vNetName, CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) @@ -218,7 +218,7 @@ public void ListAzureDedicatedCircuitLinkSuccessful() GetAzureDedicatedCircuitLinkCommand cmdlet = new GetAzureDedicatedCircuitLinkCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) }; diff --git a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitTests.cs b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitTests.cs index 3845bac4de37..658ff104a39a 100644 --- a/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitTests.cs +++ b/src/ServiceManagement/Services/Commands.Test/ExpressRoute/AzureDedicatedCircuitTests.cs @@ -156,7 +156,7 @@ public void GetAzureDedicatedCircuitSuccessful() GetAzureDedicatedCircuitCommand cmdlet = new GetAzureDedicatedCircuitCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) }; @@ -198,7 +198,7 @@ public void RemoveAzureDedicatedCircuitSuccessful() RemoveAzureDedicatedCircuitCommand cmdlet = new RemoveAzureDedicatedCircuitCommand() { - ServiceKey = serviceKey, + ServiceKey = Guid.Parse(serviceKey), CommandRuntime = mockCommandRuntime, ExpressRouteClient = new ExpressRouteClient(client.Object) }; From 6e8e47efa3119a8c06ed985349f1dbf3b4db3701 Mon Sep 17 00:00:00 2001 From: Nupur Kothari Date: Mon, 8 Jun 2015 21:41:04 -0700 Subject: [PATCH 10/10] Removed unnecessary file and also fixed missing line in azurepowershell.sln --- setup/azurepowershell.sln | 1 + .../Commands.ExpressRoute.csproj | 1 - .../Model/ValidateGuid.cs | 38 ------------------- 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Model/ValidateGuid.cs diff --git a/setup/azurepowershell.sln b/setup/azurepowershell.sln index f76d149c204c..8af1a5339b5b 100644 --- a/setup/azurepowershell.sln +++ b/setup/azurepowershell.sln @@ -1,3 +1,4 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.30110.0 MinimumVisualStudioVersion = 10.0.40219.1 diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj index dc566ff7e172..89d45187b980 100644 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj +++ b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Commands.ExpressRoute.csproj @@ -147,7 +147,6 @@ True True - diff --git a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Model/ValidateGuid.cs b/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Model/ValidateGuid.cs deleted file mode 100644 index 2fbd8c2cfb70..000000000000 --- a/src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/Model/ValidateGuid.cs +++ /dev/null @@ -1,38 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Management.Automation; -using Microsoft.WindowsAzure.Commands.ExpressRoute.Properties; - -namespace Microsoft.WindowsAzure.Commands.ExpressRoute -{ - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] - public sealed class ValidateGuid : ValidateEnumeratedArgumentsAttribute - { - protected override void ValidateElement(object element) - { - string guid = (string)element; - - try - { - Guid validGuid = Guid.Parse(guid); - } - catch - { - throw new ArgumentException(String.Format(Resources.InvalidGuid, guid)); - } - } - } -}