public PSFlowLog GetFlowLogStatus(string resourceGroupName, string name, MNM.FlowLogStatusParameters parameters) { MNM.FlowLogInformation flowLog = this.NetworkWatcherClient.GetFlowLogStatus(resourceGroupName, name, parameters); PSFlowLog psFlowLog = Mapper.Map <PSFlowLog>(flowLog); return(psFlowLog); }
public override void Execute() { base.Execute(); MNM.FlowLogStatusParameters parameters = new MNM.FlowLogStatusParameters(); parameters.TargetResourceId = this.TargetResourceId; PSFlowLog flowLog = new PSFlowLog(); 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; flowLog = GetFlowLogStatus(this.ResourceGroupName, this.NetworkWatcherName, parameters); } else if (string.Equals(this.ParameterSetName, "SetByResource", StringComparison.OrdinalIgnoreCase)) { flowLog = GetFlowLogStatus(this.NetworkWatcher.ResourceGroupName, this.NetworkWatcher.Name, parameters); } else { flowLog = GetFlowLogStatus(this.ResourceGroupName, this.NetworkWatcherName, parameters); } WriteObject(flowLog); }
public override void Execute() { base.Execute(); MNM.FlowLogStatusParameters parameters = new MNM.FlowLogStatusParameters(); parameters.TargetResourceId = this.TargetResourceId; PSFlowLog flowLog = new PSFlowLog(); if (ParameterSetName.Contains("SetByResource")) { flowLog = GetFlowLogStatus(this.NetworkWatcher.ResourceGroupName, this.NetworkWatcher.Name, parameters); } else { flowLog = GetFlowLogStatus(this.ResourceGroupName, this.NetworkWatcherName, parameters); } WriteObject(flowLog); }