Пример #1
0
        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
            case GetIotHubParameterSet:
                IotHubDescription iotHubDescription = this.IotHubClient.IotHubResource.Get(this.ResourceGroupName, this.Name);
                this.WriteObject(IotHubUtils.ToPSIotHub(iotHubDescription), false);
                break;

            case ListIotHubsByRGParameterSet:
                if (string.IsNullOrEmpty(this.ResourceGroupName))
                {
                    IEnumerable <IotHubDescription> iotHubDescriptionsBySubscription = this.IotHubClient.IotHubResource.ListBySubscription();
                    this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptionsBySubscription), true);
                    break;
                }
                else
                {
                    IEnumerable <IotHubDescription> iotHubDescriptions = this.IotHubClient.IotHubResource.ListByResourceGroup(this.ResourceGroupName);
                    this.WriteObject(IotHubUtils.ToPSIotHubs(iotHubDescriptions), true);
                    break;
                }

            default:
                throw new ArgumentException("BadParameterSetName");
            }
        }