diff --git a/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj b/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj index 3c9c93090b67..ec327bdbbb21 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj +++ b/src/ServiceManagement/Network/Commands.Network.Test/Commands.ServiceManagement.Network.Test.csproj @@ -100,8 +100,8 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll - False - ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll False diff --git a/src/ServiceManagement/Network/Commands.Network.Test/packages.config b/src/ServiceManagement/Network/Commands.Network.Test/packages.config index 67ee229ae0fa..fd55e6e6ab40 100644 --- a/src/ServiceManagement/Network/Commands.Network.Test/packages.config +++ b/src/ServiceManagement/Network/Commands.Network.Test/packages.config @@ -17,7 +17,7 @@ - + diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj index 91f6a0c0e737..90fde1475547 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.ServiceManagement.Network.csproj @@ -83,9 +83,9 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll - + False - ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll + ..\..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.2\lib\net40\Microsoft.WindowsAzure.Management.Network.dll False @@ -147,6 +147,10 @@ + + + + @@ -157,17 +161,39 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureLocalNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureLocalNetworkGateway.cs new file mode 100644 index 000000000000..b230436452b0 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureLocalNetworkGateway.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureLocalNetworkGateway"), OutputType(typeof(GetLocalNetworkGatewayContext))] + public class GetAzureLocalNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = false, HelpMessage = "Local network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(GatewayId)) + { + WriteObject(Client.GetLocalNetworkGateway(GatewayId)); + } + else + { + WriteObject(Client.ListLocalNetworkGateways()); + } + } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVNetGatewayIPsecParameters.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVNetGatewayIPsecParameters.cs index c54254a7138a..37a13390ad01 100644 --- a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVNetGatewayIPsecParameters.cs +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVNetGatewayIPsecParameters.cs @@ -14,6 +14,7 @@ using System.Management.Automation; using Microsoft.WindowsAzure.Management.Network.Models; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway { @@ -21,6 +22,7 @@ namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway public class GetAzureVNetGatewayIPsecParameters : NetworkCmdletBase { [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network name.")] + [ValidateGuid] [ValidateNotNullOrEmpty] public string VNetName { @@ -28,6 +30,7 @@ public string VNetName } [Parameter(Position = 1, Mandatory = true, HelpMessage = "The local network site name.")] + [ValidateGuid] [ValidateNotNullOrEmpty] public string LocalNetworkSiteName { diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGateway.cs new file mode 100644 index 000000000000..a62e7fb452f3 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGateway.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureVirtualNetworkGateway"), OutputType(typeof(GetVirtualNetworkGatewayContext))] + public class GetAzureVirtualNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = false, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(GatewayId)) + { + WriteObject(Client.GetVirtualNetworkGateway(GatewayId)); + } + else + { + WriteObject(Client.ListVirtualNetworkGateways()); + } + } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayConnection.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayConnection.cs new file mode 100644 index 000000000000..fd22fe276279 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayConnection.cs @@ -0,0 +1,53 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureVirtualNetworkGatewayConnection"), OutputType(typeof(GetVirtualNetworkGatewayConnectionContext))] + public class GetAzureVirtualNetworkConnectionGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = false, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = false, HelpMessage = "Virtual network gateway Connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + if (!string.IsNullOrEmpty(GatewayId) && !string.IsNullOrEmpty(ConnectedEntityId)) + { + WriteObject(Client.GetVirtualNetworkGatewayConnection(GatewayId, ConnectedEntityId)); + } + else + { + WriteObject(Client.ListVirtualNetworkGatewayConnections()); + } + } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayDiagnostics.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayDiagnostics.cs new file mode 100644 index 000000000000..4f367b18a271 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayDiagnostics.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureVirtualNetworkGatewayDiagnostics"), OutputType(typeof(ManagementOperationContext))] + public class GetAzureVirtualNetworkGatewayDiagnostics : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.GetDiagnosticsV2(GatewayId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayIPsecParameters.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayIPsecParameters.cs new file mode 100644 index 000000000000..90e8e6a9f170 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayIPsecParameters.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.Management.Automation; +using Microsoft.WindowsAzure.Management.Network.Models; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureVirtualNetworkGatewayIPsecParameters"), OutputType(typeof(IPsecParameters))] + public class GetAzureVirtualNetworkGatewayIPsecParameters : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.GetIPsecParametersV2(GatewayId, ConnectedEntityId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayKey.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayKey.cs new file mode 100644 index 000000000000..5da31292abee --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/GetAzureVirtualNetworkGatewayKey.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Get, "AzureVirtualNetworkGatewayKey"), OutputType(typeof(SharedKeyContext))] + public class GetAzureVirtualNetworkGatewayKey : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.GetSharedKeyV2(GatewayId, ConnectedEntityId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetLocalNetworkGatewayContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetLocalNetworkGatewayContext.cs new file mode 100644 index 000000000000..80084128bb8d --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetLocalNetworkGatewayContext.cs @@ -0,0 +1,31 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.Utilities.Common; +using System; +using System.Collections.Generic; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network +{ + public class GetLocalNetworkGatewayContext : ManagementOperationContext + { + public string GatewayId { get; set; } + + public string GatewayName { get; set; } + + public string IpAddress { get; set; } + + public List AddressSpace { get; set; } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayConnectionContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayConnectionContext.cs new file mode 100644 index 000000000000..ffa54c0f15bd --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayConnectionContext.cs @@ -0,0 +1,35 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.WindowsAzure.Management.Network.Models; +using System; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network +{ + public class GetVirtualNetworkGatewayConnectionContext : ManagementOperationContext + { + public string GatewayConnectionName { get; set; } + + public string VirtualNetworkGatewayId { get; set; } + + public string ConnectedEntityId { get; set; } + + public string GatewayConnectionType { get; set; } + + public int RoutingWeight { get; set; } + + public string SharedKey { get; set; } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayContext.cs new file mode 100644 index 000000000000..b1502786dfac --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/GetVirtualNetworkGatewayContext.cs @@ -0,0 +1,52 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.Utilities.Common; +using System; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network +{ + public class GetVirtualNetworkGatewayContext : ManagementOperationContext + { + public string GatewayId { get; set; } + + public string GatewayName { get; set; } + + public string LastEventData { get; set; } + + public string GatewayType { get; set; } + + public DateTime? LastEventTimeStamp { get; set; } + + public string LastEventMessage { get; set; } + + public int LastEventID { get; set; } + + public ProvisioningState State { get; set; } + + public string VIPAddress { get; set; } + + public string DefaultSite { get; set; } + + public string GatewaySKU { get; set; } + + public string Location { get; set; } + + public string VnetId { get; set; } + + public string SubnetId { get; set; } + + public string EnableBgp { get; set; } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/LocalNetwrokGatewayContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/LocalNetwrokGatewayContext.cs new file mode 100644 index 000000000000..e9187979b36f --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/LocalNetwrokGatewayContext.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model +{ + public class LocalNetwrokGatewayContext : ManagementOperationContext + { + public string LocalNetworkGatewayId { get; set; } + } +} \ No newline at end of file diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/ValidateGuid.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/ValidateGuid.cs new file mode 100644 index 000000000000..785135c7de6e --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/ValidateGuid.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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.ServiceManagement.Network.Properties; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model +{ + [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)); + } + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkDiagnosticsContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkDiagnosticsContext.cs index 4ef6e212d490..b0626a1a7018 100644 --- a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkDiagnosticsContext.cs +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkDiagnosticsContext.cs @@ -12,11 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.WindowsAzure.Management.Network.Models; + namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model { - using WindowsAzure.Commands.Utilities.Common; - using WindowsAzure.Management.Network.Models; - public class VirtualNetworkDiagnosticsContext : ManagementOperationContext { public string DiagnosticsUrl { get; set; } diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkGatewayContext.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkGatewayContext.cs index 067314f3de7f..850d24e2a6e7 100644 --- a/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkGatewayContext.cs +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/Model/VirtualNetworkGatewayContext.cs @@ -12,11 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System; + namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network { - using System; - using WindowsAzure.Commands.Utilities.Common; - public class VirtualNetworkGatewayContext : ManagementOperationContext { public string LastEventData { get; set; } diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureLocalNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureLocalNetworkGateway.cs new file mode 100644 index 000000000000..bd4f3be6b7d8 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureLocalNetworkGateway.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.New, "AzureLocalNetworkGateway"), OutputType(typeof(LocalNetwrokGatewayContext))] + public class NewAzureLocalNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway name.")] + public string GatewayName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The Ip Address of local network gateway .")] + public string IpAddress { get; set; } + + [Parameter(Position = 2, Mandatory = true, HelpMessage = "The virtual network gateway AddressSpace.")] + public List AddressSpace { get; set; } + + public override void ExecuteCmdlet() + { + WriteObject(Client.CreateLocalNetworkGateway(GatewayName, IpAddress, AddressSpace)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGateway.cs new file mode 100644 index 000000000000..ca709e038de0 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGateway.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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.New, "AzureVirtualNetworkGateway"), OutputType(typeof(ManagementOperationContext))] + public class NewAzureVirtualNetworkGatewayCommand : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network name.")] + public string VNetName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway name.")] + public string GatewayName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The type of routing that the gateway will use:StaticRouting/DynamicRouting. This will default to StaticRouting if no value is provided.")] + public string GatewayType { get; set; } + + [Parameter(Position = 3, Mandatory = false, HelpMessage = "The Gateway SKU for the new gateway:Default/HighPerformance/Standard. This will default to 'Default' SKU if no value is provided.")] + public string GatewaySKU { get; set; } + + [Parameter(Position = 4, Mandatory = false, HelpMessage = "Location for the virtual network gateway.")] + public string Location { get; set; } + + [Parameter(Position = 5, Mandatory = false, HelpMessage = "The virtual network Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string VnetId { get; set; } + + public override void ExecuteCmdlet() + { + WriteObject(Client.CreateVirtualNetworkGateway(VNetName, GatewayName, GatewayType, GatewaySKU, Location, VnetId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGatewayConnection.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGatewayConnection.cs new file mode 100644 index 000000000000..1b0f1bde19d6 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/NewAzureVirtualNetworkGatewayConnection.cs @@ -0,0 +1,55 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.New, "AzureVirtualNetworkGatewayConnection"), OutputType(typeof(ManagementOperationContext))] + public class NewAzureVirtualNetworkGatewayConnectionCommand : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Service Key / Local network gateway Id / Vnet Network Gateway Id")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connection name.")] + [ValidateNotNullOrEmpty] + public string GatewayConnectionName { get; set; } + + [Parameter(Position = 2, Mandatory = true, HelpMessage = "Gateway connection type: Ipsec/Dedicated/VpnClient/Vnet2Vnet")] + [ValidateNotNullOrEmpty] + public string GatewayConnectionType { get; set; } + + [Parameter(Position = 3, Mandatory = false, HelpMessage = "The Routing Weight.")] + public int RoutingWeight { get; set; } + + [Parameter(Position = 4, Mandatory = false, HelpMessage = "Ipsec share key.")] + public string SharedKey { get; set; } + + [Parameter(Position = 5, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string VirtualNetworkGatewayId { get; set; } + + public override void ExecuteCmdlet() + { + WriteObject(Client.CreateVirtualNetworkGatewayConnection(ConnectedEntityId, GatewayConnectionName, GatewayConnectionType, RoutingWeight, SharedKey, Guid.Parse(VirtualNetworkGatewayId))); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureLocalNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureLocalNetworkGateway.cs new file mode 100644 index 000000000000..7c59ee41174a --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureLocalNetworkGateway.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Remove, "AzureLocalNetworkGateway"), OutputType(typeof(AzureOperationResponse))] + public class RemoveAzureLocalNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Local network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.DeleteLocalNetworkGateway(GatewayId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGateway.cs new file mode 100644 index 000000000000..8af865f91ad2 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGateway.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Remove, "AzureVirtualNetworkGateway"), OutputType(typeof(ManagementOperationContext))] + public class RemoveAzureVirtualNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.DeleteVirtualNetworkGateway(GatewayId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGatewayConnection.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGatewayConnection.cs new file mode 100644 index 000000000000..97a07baf8759 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/RemoveAzureVirtualNetworkGatewayConnection.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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Remove, "AzureVirtualNetworkGatewayConnection"), OutputType(typeof(ManagementOperationContext))] + public class RemoveAzureVirtualNetworkGatewayConnection : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "Virtual network gateway connected EntityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.DeleteVirtualNetworkGatewayConnection(GatewayId, ConnectedEntityId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGateway.cs new file mode 100644 index 000000000000..37ac78b3ddc9 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGateway.cs @@ -0,0 +1,37 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; + using System.Management.Automation; + using WindowsAzure.Management.Network.Models; + + [Cmdlet(VerbsCommon.Reset, "AzureVirtualNetworkGateway"), OutputType(typeof(GatewayGetOperationStatusResponse))] + public class ResetAzureVirtualNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.ResetVirtualNetworkGateway(GatewayId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGatewayKey.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGatewayKey.cs new file mode 100644 index 000000000000..fa18f1176e36 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/ResetAzureVirtualNetworkGatewayKey.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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Management.Network.Models; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Reset, "AzureVirtualNetworkGatewayKey"), OutputType(typeof(GatewayGetOperationStatusResponse))] + public class ResetAzureVirtualNetworkGatewayKey : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + [Parameter(Position = 2, Mandatory = true, HelpMessage = "The number of characters that the shared key will contain when reset.The virtual network gateway connected entityId.")] + [ValidateNotNullOrEmpty] + public int keyLength + { + get; + set; + } + + + public override void ExecuteCmdlet() + { + WriteObject(Client.ResetSharedKeyV2(GatewayId, ConnectedEntityId, keyLength)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/ResizeAzureVirtualNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/ResizeAzureVirtualNetworkGateway.cs new file mode 100644 index 000000000000..3478ccacb8f0 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/ResizeAzureVirtualNetworkGateway.cs @@ -0,0 +1,44 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Management.Network.Models; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Resize, "AzureVirtualNetworkGateway"), OutputType(typeof(GatewayGetOperationStatusResponse))] + public class ResizeAzureVirtualNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The SKU that the existing gateway will be resized to: Default/HighPerformance/Standard")] + [ValidateNotNullOrEmpty] + public string GatewaySKU + { + get; set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.ResizeVirtualNetworkGateway(GatewayId, GatewaySKU)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayIPsecParameters.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayIPsecParameters.cs new file mode 100644 index 000000000000..4907cc3e28aa --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayIPsecParameters.cs @@ -0,0 +1,83 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.Automation; +using Microsoft.WindowsAzure.Management.Network.Models; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Set, "AzureVirtualNetworkGatewayIPsecParameters"), OutputType(typeof(GatewayGetOperationStatusResponse))] + public class SetAzureVirtualNetworkGatewayIPsecParameters : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The type of encryption that will " + + "be used for the connection between the virtual network gateway and the local network. " + + "Valid values are RequireEncryption/NoEncryption/AES256/AES128/DES3.")] + public string EncryptionType + { + get; + set; + } + + [Parameter(Position = 3, Mandatory = false, HelpMessage = "The PFS gruop that will be used " + + "for the connection between the virtual network gateway and the local network. Valid " + + "values are PFS1 and None.")] + public string PfsGroup + { + get; + set; + } + + [Parameter(Position = 4, Mandatory = false, HelpMessage = "The SA Data Size Kilobytes value " + + "is used to determine how many kilobytes of traffic can be sent before the SA for the" + + "connection will be renegotiated.")] + public int SADataSizeKilobytes + { + get; + set; + } + + [Parameter(Position = 5, Mandatory = false, HelpMessage = "The SA Lifetime Seconds value " + + "is used to determine how long (in seconds) this connection's SA will be valid before " + + "a new SA will be negotiated.")] + public int SALifetimeSeconds + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.SetIPsecParametersV2(GatewayId, ConnectedEntityId, EncryptionType, PfsGroup, SADataSizeKilobytes, SALifetimeSeconds)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayKey.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayKey.cs new file mode 100644 index 000000000000..292d5f3cff1c --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/SetAzureVirtualNetworkGatewayKey.cs @@ -0,0 +1,54 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Set, "AzureVirtualNetworkGatewayKey"), OutputType(typeof(SharedKeyContext))] + public class SetAzureVirtualNetworkGatewayKey : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The virtual network gateway id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + [Parameter(Position = 2, Mandatory = true, HelpMessage = "The shared key that will be used on the Azure Gateway and the customer's VPN device.")] + [ValidateNotNullOrEmpty] + public string SharedKey + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.SetSharedKeyV2(GatewayId, ConnectedEntityId, SharedKey)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/StartAzureVirtualNetworkGatewayDiagnostics.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/StartAzureVirtualNetworkGatewayDiagnostics.cs new file mode 100644 index 000000000000..b61c181335ce --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/StartAzureVirtualNetworkGatewayDiagnostics.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.Common.Storage; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsLifecycle.Start, "AzureVirtualNetworkGatewayDiagnostics"), OutputType(typeof(ManagementOperationContext))] + public class StartAzureVirtualNetworkGatewayDiagnostics : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId { get; set; } + + [Parameter(Position = 1, Mandatory = false, HelpMessage = "The duration of the capture in seconds (between 1 and 300)")] + [ValidateNotNullOrEmpty] + public int CaptureDurationInSeconds { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The container name provided by customer (optional)")] + [ValidateNotNullOrEmpty] + public string ContainerName { get; set; } + + [Parameter(Position = 3, Mandatory = false, HelpMessage = "The object used to access the customer's storage account. This can be created using the Get-AzureStorageContext cmdlet.")] + public AzureStorageContext StorageContext { get; set; } + + public override void ExecuteCmdlet() + { + WriteObject(Client.StartDiagnosticsV2(GatewayId, CaptureDurationInSeconds, ContainerName, StorageContext)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/StopAzureVirtualNetworkGatewayDiagnostics.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/StopAzureVirtualNetworkGatewayDiagnostics.cs new file mode 100644 index 000000000000..74e950bb3310 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/StopAzureVirtualNetworkGatewayDiagnostics.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsLifecycle.Stop, "AzureVirtualNetworkGatewayDiagnostics"), OutputType(typeof(ManagementOperationContext))] + public class StopAzureVirtualNetworkGatewayDiagnostics : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId { get; set; } + + public override void ExecuteCmdlet() + { + WriteObject(Client.StopDiagnosticsV2(GatewayId)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureLocalNetworkGateway.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureLocalNetworkGateway.cs new file mode 100644 index 000000000000..498e70abce46 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureLocalNetworkGateway.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using System.Collections.Generic; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Reset, "AzureLocalNetworkGateway"), OutputType(typeof(AzureOperationResponse))] + public class ResetAzureLocalNetworkGateway : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The local network gateway AddressSpace.")] + [ValidateNotNullOrEmpty] + public List AddressSpace + { + get; set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.UpdateLocalNetworkGateway(GatewayId, AddressSpace)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureVirtualNetworkGatewayConnection.cs b/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureVirtualNetworkGatewayConnection.cs new file mode 100644 index 000000000000..8d3312681186 --- /dev/null +++ b/src/ServiceManagement/Network/Commands.Network/Gateway/UpdateAzureVirtualNetworkGatewayConnection.cs @@ -0,0 +1,62 @@ +// ---------------------------------------------------------------------------------- +// +// 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 Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway.Model; +using Microsoft.WindowsAzure.Management.Network.Models; +using System.Management.Automation; + +namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Gateway +{ + [Cmdlet(VerbsCommon.Reset, "AzureVirtualNetworkGatewayConnection"), OutputType(typeof(GatewayGetOperationStatusResponse))] + public class ResetAzureVirtualNetworkGatewayConnection : NetworkCmdletBase + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "Virtual network gateway Id.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string GatewayId + { + get; + set; + } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The virtual network gateway connected entityId.")] + [ValidateGuid] + [ValidateNotNullOrEmpty] + public string ConnectedEntityId + { + get; + set; + } + + [Parameter(Position = 2, Mandatory = true, HelpMessage = "The Routing Weight.")] + [ValidateNotNullOrEmpty] + public int RoutingWeight + { + get; + set; + } + + [Parameter(Position = 3, Mandatory = false, HelpMessage = "The Ipsec share key.")] + public string SharedKey + { + get; + set; + } + + public override void ExecuteCmdlet() + { + WriteObject(Client.UpdateVirtualNetworkGatewayConnection(GatewayId, ConnectedEntityId, RoutingWeight, SharedKey)); + } + } +} diff --git a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs index 1c0ddf7a9bc7..6c02b09b5e38 100644 --- a/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs +++ b/src/ServiceManagement/Network/Commands.Network/NetworkClient.cs @@ -1022,5 +1022,349 @@ public string GetIPForwardingForNetworkInterface(string serviceName, string depl IPForwardingGetResponse ipForwardingGetResponse = client.IPForwarding.GetForNetworkInterface(serviceName, deploymentName, roleName, networkInterfaceName); return ipForwardingGetResponse.State; } + + public GetVirtualNetworkGatewayContext GetVirtualNetworkGateway(string gatewayId) + { + if (string.IsNullOrWhiteSpace(gatewayId)) + { + throw new ArgumentException("gatewayId cannot be null or whitespace.", "gatewayId"); + } + + VirtualNetworkGatewayGetResponse response = client.Gateways.GetVirtualNetworkGateway(gatewayId); + + GetVirtualNetworkGatewayContext gatewayContext = new GetVirtualNetworkGatewayContext() + { + GatewayId = response.GatewayId.ToString(), + GatewayName = response.GatewayName, + GatewayType = response.GatewayType, + LastEventData = (response.LastEvent != null) ? response.LastEvent.Data : null, + LastEventMessage = (response.LastEvent != null) ? response.LastEvent.Message : null, + LastEventID = GetEventId(response.LastEvent), + LastEventTimeStamp = (response.LastEvent != null) ? (DateTime?)response.LastEvent.Timestamp : null, + State = (ProvisioningState)Enum.Parse(typeof(ProvisioningState), response.State, true), + VIPAddress = response.VipAddress, + DefaultSite = (response.DefaultSite != null ? response.DefaultSite.Name : null), + GatewaySKU = response.GatewaySKU, + Location = response.Location, + VnetId = response.VnetId, + SubnetId = response.SubnetId, + EnableBgp = response.EnableBgp.ToString(), + }; + PopulateOperationContext(response.RequestId, gatewayContext); + + return gatewayContext; + } + + public GetVirtualNetworkGatewayConnectionContext GetVirtualNetworkGatewayConnection(string gatewayId, string connectedentityId) + { + if (string.IsNullOrWhiteSpace(gatewayId)) + { + throw new ArgumentException("gatewayId cannot be null or whitespace.", "gatewayId"); + } + if (string.IsNullOrWhiteSpace(connectedentityId)) + { + throw new ArgumentException("connectedentityId cannot be null or whitespace.", "connectedentityId"); + } + + GatewayConnectionGetResponse response = client.Gateways.GetGatewayConnection(gatewayId, connectedentityId); + + GetVirtualNetworkGatewayConnectionContext gatewayContext = new GetVirtualNetworkGatewayConnectionContext() + { + GatewayConnectionName = response.GatewayConnectionName.ToString(), + VirtualNetworkGatewayId = response.VirtualNetworkGatewayId.ToString(), + ConnectedEntityId = response.ConnectedEntityId, + GatewayConnectionType = response.GatewayConnectionType, + RoutingWeight = response.RoutingWeight, + SharedKey = response.SharedKey, + }; + PopulateOperationContext(response.RequestId, gatewayContext); + + return gatewayContext; + } + + public GetLocalNetworkGatewayContext GetLocalNetworkGateway(string gatewayId) + { + if (string.IsNullOrWhiteSpace(gatewayId)) + { + throw new ArgumentException("gatewayId cannot be null or whitespace.", "gatewayId"); + } + + LocalNetworkGatewayGetResponse response = client.Gateways.GetLocalNetworkGateway(gatewayId); + + GetLocalNetworkGatewayContext gatewayContext = new GetLocalNetworkGatewayContext() + { + GatewayId = response.Id.ToString(), + GatewayName = response.GatewayName, + IpAddress = response.IpAddress, + AddressSpace = response.AddressSpace.ToList(), + }; + PopulateOperationContext(response.RequestId, gatewayContext); + + return gatewayContext; + } + public IEnumerable ListVirtualNetworkGatewayConnections() + { + GatewayListGatewayConnectionsResponse response = client.Gateways.ListGatewayConnections(); + + IEnumerable connections = response.VirtualNetworkGatewayConnections.Select( + (GatewayListGatewayConnectionsResponse.VirtualNetworkGatewayConnection connection) => + { + return new GetVirtualNetworkGatewayConnectionContext() + { + GatewayConnectionName = connection.GatewayConnectionName, + VirtualNetworkGatewayId = connection.VirtualNetworkGatewayId.ToString(), + ConnectedEntityId = connection.ConnectedEntityId, + GatewayConnectionType = connection.GatewayConnectionType, + RoutingWeight = connection.RoutingWeight, + SharedKey = connection.SharedKey, + }; + }); + PopulateOperationContext(response.RequestId, connections); + + return connections; + } + + public IEnumerable ListVirtualNetworkGateways() + { + ListVirtualNetworkGatewaysResponse response = client.Gateways.ListVirtualNetworkGateways(); + + IEnumerable virtualNetworkGateways = response.VirtualNetworkGateways.Select( + (ListVirtualNetworkGatewaysResponse.VirtualNetworkGateway virtualNetworkGateway) => + { + return new GetVirtualNetworkGatewayContext() + { + GatewayId = virtualNetworkGateway.GatewayId.ToString(), + GatewayName = virtualNetworkGateway.GatewayName, + GatewayType = virtualNetworkGateway.GatewayType, + LastEventData = (virtualNetworkGateway.LastEvent != null) ? virtualNetworkGateway.LastEvent.Data : null, + LastEventMessage = (virtualNetworkGateway.LastEvent != null) ? virtualNetworkGateway.LastEvent.Message : null, + LastEventID = GetEventId(virtualNetworkGateway.LastEvent), + LastEventTimeStamp = (virtualNetworkGateway.LastEvent != null) ? (DateTime?)virtualNetworkGateway.LastEvent.Timestamp : null, + State = (ProvisioningState)Enum.Parse(typeof(ProvisioningState), virtualNetworkGateway.State, true), + VIPAddress = virtualNetworkGateway.VipAddress, + DefaultSite = (virtualNetworkGateway.DefaultSite != null ? virtualNetworkGateway.DefaultSite.Name : null), + GatewaySKU = virtualNetworkGateway.GatewaySKU, + Location = virtualNetworkGateway.Location, + VnetId = virtualNetworkGateway.VnetId, + SubnetId = virtualNetworkGateway.SubnetId, + EnableBgp = virtualNetworkGateway.EnableBgp.ToString(), + }; + }); + PopulateOperationContext(response.RequestId, virtualNetworkGateways); + + return virtualNetworkGateways; + } + + public IEnumerable ListLocalNetworkGateways() + { + ListLocalNetworkGatewaysResponse response = client.Gateways.ListLocalNetworkGateways(); + + IEnumerable localNetworkGateways = response.LocalNetworkGateways.Select( + (ListLocalNetworkGatewaysResponse.LocalNetworkGateway localNetworkGateway) => + { + return new GetLocalNetworkGatewayContext() + { + GatewayId = localNetworkGateway.Id.ToString(), + GatewayName = localNetworkGateway.GatewayName, + IpAddress = localNetworkGateway.IpAddress, + AddressSpace = localNetworkGateway.AddressSpace.ToList(), + }; + }); + PopulateOperationContext(response.RequestId, localNetworkGateways); + + return localNetworkGateways; + } + + public VirtualNetworkDiagnosticsContext GetDiagnosticsV2(string gatewayId) + { + GatewayDiagnosticsStatus diagnosticsStatus = client.Gateways.GetDiagnosticsV2(gatewayId); + + VirtualNetworkDiagnosticsContext diagnosticsContext = new VirtualNetworkDiagnosticsContext() + { + DiagnosticsUrl = diagnosticsStatus.DiagnosticsUrl, + State = diagnosticsStatus.State, + }; + PopulateOperationContext(diagnosticsStatus.RequestId, diagnosticsContext); + + return diagnosticsContext; + } + + public SharedKeyContext GetSharedKeyV2(string gatewayId, string connectedentityId) + { + GatewayGetSharedKeyResponse response = client.Gateways.GetSharedKeyV2(gatewayId, connectedentityId); + + SharedKeyContext sharedKeyContext = new SharedKeyContext() + { + Value = response.SharedKey + }; + PopulateOperationContext(response.RequestId, sharedKeyContext); + + return sharedKeyContext; + } + + public GatewayGetOperationStatusResponse CreateVirtualNetworkGateway(string vnetName, string gatewayName, string gatewayType, string gatewaySKU, string location, string vnetId) + { + VirtualNetworkGatewayCreateParameters parameters = new VirtualNetworkGatewayCreateParameters() + { + GatewayName = gatewayName, + GatewaySKU = gatewaySKU, + GatewayType = gatewayType, + Location = location, + VnetId = vnetId, + }; + + return client.Gateways.CreateVirtualNetworkGateway(vnetName, parameters); + } + + public GatewayGetOperationStatusResponse CreateVirtualNetworkGatewayConnection(string connectedEntityId, string gatewayConnectionName, string gatewayConnectionType, + int routingWeight, string sharedKey, Guid virtualNetworkGatewayId) + { + GatewayConnectionCreateParameters parameters = new GatewayConnectionCreateParameters() + { + ConnectedEntityId = connectedEntityId, + GatewayConnectionName = gatewayConnectionName, + GatewayConnectionType = gatewayConnectionType, + VirtualNetworkGatewayId = virtualNetworkGatewayId, + RoutingWeight = routingWeight, + SharedKey = sharedKey, + }; + + return client.Gateways.CreateGatewayConnection(parameters); + } + + public LocalNetworkGatewayCreateResponse CreateLocalNetworkGateway(string gatewayName, string ipAddress, List addressSpace) + { + LocalNetworkGatewayCreateParameters parameters = new LocalNetworkGatewayCreateParameters() + { + AddressSpace = addressSpace, + GatewayName = gatewayName, + IpAddress = ipAddress, + }; + + return client.Gateways.CreateLocalNetworkGateway(parameters); + } + + public GatewayGetOperationStatusResponse DeleteVirtualNetworkGateway(string gatewayId) + { + return client.Gateways.DeleteVirtualNetworkGateway(gatewayId); + } + + public GatewayGetOperationStatusResponse DeleteVirtualNetworkGatewayConnection(string gatewayId, string connectedentityId) + { + return client.Gateways.DeleteGatewayConnection(gatewayId, connectedentityId); + } + + public AzureOperationResponse DeleteLocalNetworkGateway(string gatewayId) + { + return client.Gateways.DeleteLocalNetworkGateway(gatewayId); + } + + public GatewayGetOperationStatusResponse ResetVirtualNetworkGateway(string gatewayId) + { + ResetGatewayParameters parameters = new ResetGatewayParameters(); + return client.Gateways.ResetVirtualNetworkGateway(gatewayId, parameters); + } + + public GatewayGetOperationStatusResponse SetSharedKeyV2(string gatewayId, string connectedentityId, string sharedKey) + { + GatewaySetSharedKeyParameters sharedKeyParameters = new GatewaySetSharedKeyParameters() + { + Value = sharedKey, + }; + + return client.Gateways.SetSharedKeyV2(gatewayId, connectedentityId, sharedKeyParameters); + } + + public GatewayGetOperationStatusResponse ResetSharedKeyV2(string gatewayId, string connectedentityId, int keyLength) + { + GatewayResetSharedKeyParameters parameters = new GatewayResetSharedKeyParameters() + { + KeyLength = keyLength, + }; + return client.Gateways.ResetSharedKeyV2(gatewayId, connectedentityId, parameters); + } + + public GatewayGetOperationStatusResponse ResizeVirtualNetworkGateway(string gatewayId, string gatewaySKU) + { + ResizeGatewayParameters parameters = new ResizeGatewayParameters() + { + GatewaySKU = gatewaySKU, + }; + return client.Gateways.ResizeVirtualNetworkGateway(gatewayId, parameters); + } + + public GatewayGetOperationStatusResponse UpdateVirtualNetworkGatewayConnection(string gatewayId, string connectedentityId, int routingWeight, string sharedKey) + { + UpdateGatewayConnectionParameters parameters = new UpdateGatewayConnectionParameters() + { + RoutingWeight = routingWeight, + SharedKey = sharedKey, + }; + return client.Gateways.UpdateGatewayConnection(gatewayId, connectedentityId, parameters); + } + + public AzureOperationResponse UpdateLocalNetworkGateway(string gatewayId, List addressSpace) + { + UpdateLocalNetworkGatewayParameters parameters = new UpdateLocalNetworkGatewayParameters() + { + AddressSpace = addressSpace, + }; + + return client.Gateways.UpdateLocalNetworkGateway(gatewayId, parameters); + } + + public GatewayGetOperationStatusResponse StartDiagnosticsV2(string gatewayId, int captureDurationInSeconds, string containerName, AzureStorageContext storageContext) + { + StorageCredentials credentials = storageContext.StorageAccount.Credentials; + string customerStorageKey = credentials.ExportBase64EncodedKey(); + string customerStorageName = credentials.AccountName; + return StartDiagnosticsV2(gatewayId, captureDurationInSeconds, containerName, customerStorageKey, customerStorageName); + } + public GatewayGetOperationStatusResponse StartDiagnosticsV2(string gatewayId, int captureDurationInSeconds, string containerName, string customerStorageKey, string customerStorageName) + { + StartGatewayPublicDiagnosticsParameters parameters = new StartGatewayPublicDiagnosticsParameters() + { + CaptureDurationInSeconds = captureDurationInSeconds.ToString(), + ContainerName = containerName, + CustomerStorageKey = customerStorageKey, + CustomerStorageName = customerStorageName, + Operation = UpdateGatewayPublicDiagnosticsOperation.StartDiagnostics, + }; + + return client.Gateways.StartDiagnosticsV2(gatewayId, parameters); + } + + public GatewayOperationResponse StopDiagnosticsV2(string gatewayId) + { + StopGatewayPublicDiagnosticsParameters parameters = new StopGatewayPublicDiagnosticsParameters() + { + Operation = UpdateGatewayPublicDiagnosticsOperation.StopDiagnostics, + }; + + return client.Gateways.StopDiagnosticsV2(gatewayId, parameters); + } + + public GatewayGetOperationStatusResponse SetIPsecParametersV2(string gatewayId, string connectedentityId, string encryptionType, string pfsGroup, int saDataSizeKilobytes, int saLifetimeSeconds) + { + GatewaySetIPsecParametersParameters parameters = new GatewaySetIPsecParametersParameters() + { + Parameters = new IPsecParameters() + { + EncryptionType = encryptionType, + PfsGroup = pfsGroup, + SADataSizeKilobytes = saDataSizeKilobytes, + SALifeTimeSeconds = saLifetimeSeconds, + }, + }; + + return client.Gateways.SetIPsecParametersV2(gatewayId, connectedentityId, parameters); + } + + public IPsecParameters GetIPsecParametersV2(string gatewayId, string connectedentityId) + { + return client.Gateways.GetIPsecParametersV2(gatewayId, connectedentityId).IPsecParameters; + } + + } } diff --git a/src/ServiceManagement/Network/Commands.Network/Properties/Resources.Designer.cs b/src/ServiceManagement/Network/Commands.Network/Properties/Resources.Designer.cs index 1c03656c78d2..5ff95676fe6d 100644 --- a/src/ServiceManagement/Network/Commands.Network/Properties/Resources.Designer.cs +++ b/src/ServiceManagement/Network/Commands.Network/Properties/Resources.Designer.cs @@ -45,7 +45,18 @@ internal Resources() { return resourceMan; } } - + + /// + /// Looks up a localized string similar to The value {0} is an invalid GUID.. + /// + internal static string InvalidGuid + { + get + { + return ResourceManager.GetString("InvalidGuid", resourceCulture); + } + } + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. diff --git a/src/ServiceManagement/Network/Commands.Network/Properties/Resources.resx b/src/ServiceManagement/Network/Commands.Network/Properties/Resources.resx index 2c0cbf71eb1a..d71f1226fd99 100644 --- a/src/ServiceManagement/Network/Commands.Network/Properties/Resources.resx +++ b/src/ServiceManagement/Network/Commands.Network/Properties/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + The value {0} is an invalid GUID. + Not able to find the cache service just now created diff --git a/src/ServiceManagement/Network/Commands.Network/packages.config b/src/ServiceManagement/Network/Commands.Network/packages.config index 775bc74e1354..8a0b2891becc 100644 --- a/src/ServiceManagement/Network/Commands.Network/packages.config +++ b/src/ServiceManagement/Network/Commands.Network/packages.config @@ -17,7 +17,7 @@ - +