Пример #1
0
        public PSTopology GetTopology(string resourceGroupName, string name, MNM.TopologyParameters parameters)
        {
            MNM.Topology topology   = this.NetworkWatcherClient.GetTopology(resourceGroupName, name, parameters);
            PSTopology   psTopology = NetworkResourceManagerProfile.Mapper.Map <PSTopology>(topology);

            return(psTopology);
        }
Пример #2
0
        public override void Execute()
        {
            base.Execute();
            MNM.TopologyParameters parameters = new MNM.TopologyParameters();
            parameters.TargetResourceGroupName = this.TargetResourceGroupName;

            PSTopology topology = new PSTopology();

            if (string.Equals(this.ParameterSetName, "SetByLocation", StringComparison.OrdinalIgnoreCase))
            {
                var networkWatcher = this.GetNetworkWatcherByLocation(this.Location);

                if (networkWatcher == null)
                {
                    throw new ArgumentException("There is no network watcher in location {0}", this.Location);
                }

                this.ResourceGroupName  = NetworkBaseCmdlet.GetResourceGroup(networkWatcher.Id);
                this.NetworkWatcherName = networkWatcher.Name;
                topology = GetTopology(this.ResourceGroupName, this.NetworkWatcherName, parameters);
            }
            else if (string.Equals(this.ParameterSetName, "SetByResource", StringComparison.OrdinalIgnoreCase))
            {
                topology = GetTopology(this.NetworkWatcher.ResourceGroupName, this.NetworkWatcher.Name, parameters);
            }
            else
            {
                topology = GetTopology(this.ResourceGroupName, this.NetworkWatcherName, parameters);
            }
            WriteObject(topology);
        }
        public override void Execute()
        {
            base.Execute();
            MNM.TopologyParameters parameters = new MNM.TopologyParameters();
            parameters.TargetResourceGroupName = this.TargetResourceGroupName;

            PSTopology topology = new PSTopology();

            if (ParameterSetName.Contains("SetByResource"))
            {
                topology = GetTopology(this.NetworkWatcher.ResourceGroupName, this.NetworkWatcher.Name, parameters);
            }
            else
            {
                topology = GetTopology(this.ResourceGroupName, this.NetworkWatcherName, parameters);
            }
            WriteObject(topology);
        }