コード例 #1
0
        public override void ExecuteCmdlet()
        {
            var circuit = ExpressRouteClient.NewAzureDedicatedCircuit(CircuitName, Bandwidth, Location,
                                                                      ServiceProviderName);

            WriteObject(circuit);
        }
        public override void ExecuteCmdlet()
        {
            var mapping = ExpressRouteClient.NewAzureDedicatedCircuitLinkAuthorization(ServiceKey, Description, Limit,
                                                                                       MicrosoftIds);

            WriteObject(mapping);
        }
コード例 #3
0
        public override void ExecuteCmdlet()
        {
            if (string.IsNullOrEmpty(AccessType))
            {
                AzureDedicatedCircuitStats stats = new AzureDedicatedCircuitStats
                {
                    PrimaryBytesIn    = (ulong)0,
                    PrimaryBytesOut   = (ulong)0,
                    SecondaryBytesIn  = (ulong)0,
                    SecondaryBytesOut = (ulong)0
                };
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Private);
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Public);
                stats = compute(stats, ServiceKey, BgpPeeringAccessType.Microsoft);

                WriteObject(stats);
            }
            BgpPeeringAccessType type;

            if (BgpPeeringAccessType.TryParse(AccessType, true, out type))
            {
                var stats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(ServiceKey, type);
                WriteObject(stats);
            }
        }
コード例 #4
0
        public override void ExecuteCmdlet()
        {
            var route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, AdvertisedPublicPrefixes, CustomerAsn, PeerAsn,
                                                              PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId, AccessType, SharedKey);

            WriteObject(route);
        }
コード例 #5
0
        public override void ExecuteCmdlet()
        {
            var route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAsn, PrimaryPeerSubnet,
                                                              SecondaryPeerSubnet, VlanId, AccessType, SharedKey);

            WriteObject(route);
        }
コード例 #6
0
        public override void ExecuteCmdlet()
        {
            var arpInfo = ExpressRouteClient.GetAzureDedicatedCircuitPeeringArpInfo(ServiceKey, AccessType, BgpPeeringDevicePath);

            Console.WriteLine(arpInfo);
            WriteObject(arpInfo);
        }
コード例 #7
0
        public override void ExecuteCmdlet()
        {
            AzureBgpPeering route = null;

            route = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAddressType, AdvertisedPublicPrefixes, CustomerAsn, PeerAsn, PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet,
                                                          VlanId, AccessType, SharedKey, Convert.ToUInt32(LegacyMode));

            WriteObject(route);
        }
コード例 #8
0
        public override void ExecuteCmdlet()
        {
            var           routeSummary = ExpressRouteClient.GetAzureDedicatedCircuitPeeringRouteTableSummary(ServiceKey, AccessType, Path);
            StringBuilder sb           = new StringBuilder();

            sb.AppendLine("");
            sb.AppendLine("Route Table Summary:");
            WriteObject(CommonParser.parseResult(routeSummary, sb));
        }
コード例 #9
0
        private AzureDedicatedCircuitStats compute(AzureDedicatedCircuitStats stats, Guid key, BgpPeeringAccessType type)
        {
            var tempstats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(key, type);

            stats.PrimaryBytesIn    += tempstats.PrimaryBytesIn;
            stats.PrimaryBytesOut   += tempstats.PrimaryBytesOut;
            stats.SecondaryBytesIn  += tempstats.SecondaryBytesIn;
            stats.SecondaryBytesOut += tempstats.SecondaryBytesOut;
            return(stats);
        }
        public override void ExecuteCmdlet()
        {
            var arpInfo = ExpressRouteClient.GetAzureDedicatedCircuitPeeringArpInfo(ServiceKey, AccessType, Path);
            // parse output to a more user-friendly output
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("");
            sb.AppendLine("ARP Info:");
            WriteObject(CommonParser.parseResult(arpInfo, sb));
        }
コード例 #11
0
        public override void ExecuteCmdlet()
        {
            var peer = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);

            if (AccessType != BgpPeeringAccessType.Microsoft)
            {
                peer.LegacyMode = 1;
            }

            WriteObject(peer);
        }
コード例 #12
0
        public override void ExecuteCmdlet()
        {
            var crossConnection = ExpressRouteClient.SetAzureCrossConnection(ServiceKey, new CrossConnectionUpdateParameters()
            {
                Operation = Operation, ProvisioningError = ProvisioningError
            });

            if (PassThru.IsPresent)
            {
                WriteObject(crossConnection);
            }
        }
コード例 #13
0
 public override void ExecuteCmdlet()
 {
     try
     {
         ExpressRouteClient.GetAzureDedicatedCircuitLinkAuthorization(ServiceKey, AuthorizationId);
         var updatedAuthorization = ExpressRouteClient.SetAzureDedicatedCircuitLinkAuthorization(ServiceKey, AuthorizationId, Description, Limit);
         WriteObject(updatedAuthorization, false);
     }
     catch
     {
         var newAuthorization = ExpressRouteClient.NewAzureDedicatedCircuitLinkAuthorization(ServiceKey, Description, Limit, MicrosoftIds);
         WriteObject(newAuthorization);
     }
 }
コード例 #14
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         Force.IsPresent,
         string.Format(Resources.NewAzureCrossConnectionWarning, ServiceKey),
         string.Format(Resources.NewAzureCrossConnectionMessage, ServiceKey),
         ServiceKey.ToString(),
         () =>
     {
         var crossConnection = ExpressRouteClient.NewAzureCrossConnection(ServiceKey);
         WriteVerboseWithTimestamp(Resources.NewAzureCrossConnectionSucceeded);
         WriteObject(crossConnection);
     });
 }
        public override void ExecuteCmdlet()
        {
            ConfirmAction(
                Force.IsPresent,
                string.Format(Resources.SetAzureDedicatedCircuitBandwidthWarning, ServiceKey, Bandwidth, Sku, BillingType),
                Resources.SetAzureDedicatedCircuitBandwidthMessage,
                ServiceKey.ToString(),
                () =>
            {
                var circuit = ExpressRouteClient.SetAzureDedicatedCircuitProperties(ServiceKey, Bandwidth, Sku, BillingType);

                WriteObject(circuit);
            });
        }
コード例 #16
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         Force.IsPresent,
         string.Format(Resources.NewAzureDedicatedCircuitWarning, CircuitName, ServiceProviderName),
         string.Format(Resources.NewAzureDedicatedCircuitMessage, CircuitName, ServiceProviderName),
         CircuitName + " " + ServiceProviderName,
         () =>
     {
         var circuit = ExpressRouteClient.NewAzureDedicatedCircuit(CircuitName, Bandwidth, Location,
                                                                   ServiceProviderName, Sku, BillingType);
         WriteVerboseWithTimestamp(Resources.NewAzureDedicatedCircuitSucceeded);
         WriteObject(circuit);
     });
 }
コード例 #17
0
        public override void ExecuteCmdlet()
        {
            try
            {
                var route = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);

                var advertisedPublicPrefixes = AdvertisedPublicPrefixes ?? ((PeerAddressType == PeerAddressTypeValues.IPv4) ? route.AdvertisedPublicPrefixes : route.AdvertisedPublicPrefixesIpv6);
                var routingRegistryName      = RoutingRegistryName ?? ((PeerAddressType == PeerAddressTypeValues.IPv4) ? route.RoutingRegistryName : route.RoutingRegistryNameIpv6);
                var customerAsn = (CustomerAsn.HasValue) ? CustomerAsn.Value : ((PeerAddressType == PeerAddressTypeValues.IPv4) ? route.CustomerAutonomousSystemNumber : route.CustomerAutonomousSystemNumberIpv6);

                var updatedRoute = ExpressRouteClient.UpdateAzureBGPPeering(ServiceKey, PeerAddressType, AccessType,
                                                                            advertisedPublicPrefixes, customerAsn, PeerAsn.HasValue ? PeerAsn.Value : route.PeerAsn, PrimaryPeerSubnet,
                                                                            routingRegistryName, SecondaryPeerSubnet, VlanId.HasValue ? VlanId.Value : route.VlanId,
                                                                            string.IsNullOrWhiteSpace(SharedKey) ? null : SharedKey.Trim());

                WriteObject(updatedRoute, false);
            }
            catch
            {
                if (!PeerAsn.HasValue)
                {
                    throw new ArgumentException(Resources.PeerAsnRequired);
                }

                if (!VlanId.HasValue)
                {
                    throw new ArgumentException(Resources.VlanIdRequired);
                }

                if (PrimaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.PrimaryPeerSubnetRequired);
                }

                if (SecondaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.SecondaryPeerSubnetRequired);
                }

                var newRoute = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAddressType, AdvertisedPublicPrefixes, CustomerAsn.Value, PeerAsn.Value, PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet,
                                                                     VlanId.Value, AccessType, SharedKey);
                WriteObject(newRoute);
            }
        }
コード例 #18
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         Force.IsPresent,
         string.Format(Resources.RemoveAzureBGPPeeringWarning, ServiceKey),
         Resources.RemoveAzureBGPPeeringMessage,
         ServiceKey.ToString(),
         () =>
     {
         if (PeerAddressType == BgpPeerAddressType.All || AccessType != BgpPeeringAccessType.Microsoft)
         {
             if (!ExpressRouteClient.RemoveAzureBGPPeering(ServiceKey, AccessType, BgpPeerAddressType.All))
             {
                 throw new Exception(Resources.RemoveAzureBGPPeeringFailed);
             }
             else
             {
                 WriteVerboseWithTimestamp(Resources.RemoveAzureBGPPeeringSucceeded, ServiceKey);
                 if (PassThru.IsPresent)
                 {
                     WriteObject(true);
                 }
             }
         }
         else
         {
             if (!ExpressRouteClient.RemoveAzureBGPPeering(ServiceKey, AccessType, (BgpPeerAddressType)PeerAddressType))
             {
                 throw new Exception(Resources.RemoveAzureBGPPeeringFailed);
             }
             else
             {
                 WriteVerboseWithTimestamp(Resources.RemoveAzureBGPPeeringFailed, ServiceKey);
                 if (PassThru.IsPresent)
                 {
                     WriteObject(true);
                 }
             }
         }
     });
 }
        public override void ExecuteCmdlet()
        {
            ConfirmAction(
                Force.IsPresent,
                string.Format(Resources.RemoveAzureDedicatedCircuitLinkAuthorizationWarning, ServiceKey, AuthorizationId),
                Resources.RemoveAzureDedicatedCircuitLinkAuthorizationMessage,
                ServiceKey + " " + AuthorizationId,
                () =>
            {
                if (!ExpressRouteClient.RemoveAzureDedicatedCircuitLinkAuthorization(ServiceKey, AuthorizationId))
                {
                    throw new Exception(Resources.RemoveAzureDedicatedCircuitLinkAuthorizationFailed);
                }

                WriteVerboseWithTimestamp(Resources.RemoveAzureDedicatedCircuitLinkAuthorizationSucceeded, ServiceKey, AuthorizationId);
                if (PassThru.IsPresent)
                {
                    WriteObject(true);
                }
            });
        }
コード例 #20
0
 private AzureDedicatedCircuitStats compute(AzureDedicatedCircuitStats stats, Guid key, BgpPeeringAccessType type)
 {
     try
     {
         AzureBgpPeering peering = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, type);
         if (peering != null)
         {
             var tempstats = ExpressRouteClient.GetAzureDedicatedCircuitStatsInfo(key, type);
             stats.PrimaryBytesIn    += tempstats.PrimaryBytesIn;
             stats.PrimaryBytesOut   += tempstats.PrimaryBytesOut;
             stats.SecondaryBytesIn  += tempstats.SecondaryBytesIn;
             stats.SecondaryBytesOut += tempstats.SecondaryBytesOut;
         }
         return(stats);
     }
     catch
     {
         // The cirucit might not have corresponding peering
         return(stats);
     }
 }
コード例 #21
0
        public override void ExecuteCmdlet()
        {
            try
            {
                var route        = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);
                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);
            }
            catch
            {
                if (!PeerAsn.HasValue)
                {
                    throw new ArgumentException(Resources.PeerAsnRequired);
                }

                if (!VlanId.HasValue)
                {
                    throw new ArgumentException(Resources.VlanIdRequired);
                }

                if (PrimaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.PrimaryPeerSubnetRequired);
                }

                if (SecondaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.SecondaryPeerSubnetRequired);
                }

                var newRoute = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, AdvertisedPublicPrefixes, CustomerAsn,
                                                                     PeerAsn.Value, PrimaryPeerSubnet, RoutingRegistryName, SecondaryPeerSubnet, VlanId.Value, AccessType,
                                                                     SharedKey);
                WriteObject(newRoute);
            }
        }
コード例 #22
0
        public override void ExecuteCmdlet()
        {
            try
            {
                var route        = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);
                var updatedRoute = ExpressRouteClient.UpdateAzureBGPPeering(ServiceKey, AccessType,
                                                                            PeerAsn.HasValue ? PeerAsn.Value : route.PeerAutonomousSystemNumber, PrimaryPeerSubnet ?? route.PrimaryPeerSubnet,
                                                                            SecondaryPeerSubnet ?? route.SecondaryPeerSubnet, VlanId.HasValue ? VlanId.Value : route.VirtualLanId,
                                                                            SharedKey);
                WriteObject(updatedRoute, false);
            }
            catch
            {
                if (!PeerAsn.HasValue)
                {
                    throw new ArgumentException(Resources.PeerAsnRequired);
                }

                if (!VlanId.HasValue)
                {
                    throw new ArgumentException(Resources.VlanIdRequired);
                }

                if (PrimaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.PrimaryPeerSubnetRequired);
                }

                if (SecondaryPeerSubnet == null)
                {
                    throw new ArgumentException(Resources.SecondaryPeerSubnetRequired);
                }

                var newRoute = ExpressRouteClient.NewAzureBGPPeering(ServiceKey, PeerAsn.Value, PrimaryPeerSubnet,
                                                                     SecondaryPeerSubnet, VlanId.Value, AccessType, SharedKey);
                WriteObject(newRoute);
            }
        }
コード例 #23
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         Force.IsPresent,
         string.Format(Resources.RemoveAzureDedicatedCircuitLinkWarning, ServiceKey, VNetName),
         Resources.RemoveAzureDedicatedCircuitLinkMessage,
         ServiceKey + " " + VNetName,
         () =>
     {
         if (!ExpressRouteClient.RemoveAzureDedicatedCircuitLink(ServiceKey, VNetName))
         {
             throw new Exception(Resources.RemoveAzureDedicatedCircuitLinkFailed);
         }
         else
         {
             WriteVerboseWithTimestamp(Resources.RemoveAzureDedicatedCircuitLinkSucceeded, ServiceKey, VNetName);
             if (PassThru.IsPresent)
             {
                 WriteObject(true);
             }
         }
     });
 }
        public override void ExecuteCmdlet()
        {
            var mapping = ExpressRouteClient.RemoveAzureDedicatedCircuitLinkAuthorizationMicrosoftIds(ServiceKey, AuthorizationId, MicrosoftIds);

            WriteObject(mapping);
        }
        private void GetByAuthorizationId()
        {
            var linkAuth = ExpressRouteClient.GetAzureDedicatedCircuitLinkAuthorization(ServiceKey, AuthorizationId);

            WriteObject(linkAuth);
        }
コード例 #26
0
        private void GetNoVNetName()
        {
            var links = ExpressRouteClient.ListAzureDedicatedCircuitLink(ServiceKey);

            WriteObject(links, true);
        }
コード例 #27
0
        private void GetByVNetName()
        {
            var link = ExpressRouteClient.GetAzureDedicatedCircuitLink(ServiceKey, VNetName);

            WriteObject(link);
        }
コード例 #28
0
        public override void ExecuteCmdlet()
        {
            var mapping = ExpressRouteClient.NewAzureDedicatedCircuitLink(ServiceKey, VNetName);

            WriteObject(mapping);
        }
コード例 #29
0
        public override void ExecuteCmdlet()
        {
            var route = ExpressRouteClient.GetAzureBGPPeering(ServiceKey, AccessType);

            WriteObject(route);
        }
        private void GetNoAuthorizationId()
        {
            var linkAuths = ExpressRouteClient.ListAzureDedicatedCircuitLinkAuthorizations(ServiceKey);

            WriteObject(linkAuths, true);
        }