protected void ExecuteAvailabilitySetGetMethod(object[] invokeMethodInputParameters) { string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]); string availabilitySetName = (string)ParseParameter(invokeMethodInputParameters[1]); if (!string.IsNullOrEmpty(resourceGroupName) && !string.IsNullOrEmpty(availabilitySetName)) { var result = AvailabilitySetsClient.Get(resourceGroupName, availabilitySetName); WriteObject(result); } else if (!string.IsNullOrEmpty(resourceGroupName)) { var result = AvailabilitySetsClient.List(resourceGroupName); var resultList = result.ToList(); WriteObject(resultList, true); } }
protected void ExecuteAvailabilitySetGetMethod(object[] invokeMethodInputParameters) { string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]); string availabilitySetName = (string)ParseParameter(invokeMethodInputParameters[1]); if (!string.IsNullOrEmpty(resourceGroupName) && !string.IsNullOrEmpty(availabilitySetName)) { var result = AvailabilitySetsClient.Get(resourceGroupName, availabilitySetName); var psObject = new PSAvailabilitySet(); Mapper.Map <AvailabilitySet, PSAvailabilitySet>(result, psObject); WriteObject(psObject); } else if (!string.IsNullOrEmpty(resourceGroupName)) { var result = AvailabilitySetsClient.List(resourceGroupName); var psObject = new List <PSAvailabilitySetList>(); foreach (var r in result) { psObject.Add(Mapper.Map <AvailabilitySet, PSAvailabilitySetList>(r)); } WriteObject(psObject); } }