public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            var parameters = new VirtualMachineExtensionImageGetParameters
            {
                Location = Location.Canonicalize(),
                PublisherName = PublisherName,
                Type = Type,
                FilterExpression = FilterExpression,
                Version = Version
            };

            VirtualMachineExtensionImageGetResponse result = this.VirtualMachineExtensionImageClient.Get(parameters);

            var image = new PSVirtualMachineExtensionImageDetails
            {
                RequestId = result.RequestId,
                StatusCode = result.StatusCode,
                Id = result.VirtualMachineExtensionImage.Id,
                Location = result.VirtualMachineExtensionImage.Location,
                Name = result.VirtualMachineExtensionImage.Name,
                HandlerSchema = result.VirtualMachineExtensionImage.HandlerSchema,
                OperatingSystem = result.VirtualMachineExtensionImage.OperatingSystem,
                ComputeRole = result.VirtualMachineExtensionImage.ComputeRole,
                SupportsMultipleExtensions = result.VirtualMachineExtensionImage.SupportsMultipleExtensions,
                VMScaleSetEnabled = result.VirtualMachineExtensionImage.VMScaleSetEnabled,
                PublisherName = this.PublisherName,
                Type = this.Type,
                Version = this.Version
            };

            WriteObject(image);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            ExecuteClientAction(() =>
            {
                if (string.IsNullOrEmpty(this.Version))
                {
                    var parameters = new VirtualMachineExtensionImageListVersionsParameters
                    {
                        Location = Location.Canonicalize(),
                        PublisherName = PublisherName,
                        Type = Type,
                        FilterExpression = FilterExpression
                    };

                    VirtualMachineImageResourceList result = this.VirtualMachineExtensionImageClient.ListVersions(parameters);

                    var images = from r in result.Resources
                                 select new PSVirtualMachineExtensionImage
                                 {
                                     RequestId = result.RequestId,
                                     StatusCode = result.StatusCode,
                                     Id = r.Id,
                                     Location = r.Location,
                                     Version = r.Name,
                                     PublisherName = this.PublisherName,
                                     Type = this.Type,
                                     FilterExpression = this.FilterExpression
                                 };

                    WriteObject(images, true);
                }
                else
                {

                    var parameters = new VirtualMachineExtensionImageGetParameters
                    {
                        Location = Location.Canonicalize(),
                        PublisherName = PublisherName,
                        Type = Type,
                        FilterExpression = FilterExpression,
                        Version = Version
                    };

                    VirtualMachineExtensionImageGetResponse result = this.VirtualMachineExtensionImageClient.Get(parameters);

                    var image = new PSVirtualMachineExtensionImageDetails
                    {
                        RequestId = result.RequestId,
                        StatusCode = result.StatusCode,
                        Id = result.VirtualMachineExtensionImage.Id,
                        Location = result.VirtualMachineExtensionImage.Location,
                        HandlerSchema = result.VirtualMachineExtensionImage.HandlerSchema,
                        OperatingSystem = result.VirtualMachineExtensionImage.OperatingSystem,
                        ComputeRole = result.VirtualMachineExtensionImage.ComputeRole,
                        SupportsMultipleExtensions = result.VirtualMachineExtensionImage.SupportsMultipleExtensions,
                        VMScaleSetEnabled = result.VirtualMachineExtensionImage.VMScaleSetEnabled,
                        Version = result.VirtualMachineExtensionImage.Name,
                        PublisherName = this.PublisherName,
                        Type = this.Type,
                        FilterExpression = this.FilterExpression
                    };

                    WriteObject(image);
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            ExecuteClientAction(() =>
            {
                if (string.IsNullOrEmpty(this.Version))
                {
                    var filter = new ODataQuery<VirtualMachineImageResource>(this.FilterExpression);

                    var result = this.VirtualMachineExtensionImageClient.ListVersionsWithHttpMessagesAsync(
                        this.Location.Canonicalize(),
                        this.PublisherName,
                        this.Type,
                        odataQuery: filter).GetAwaiter().GetResult();

                    var images = from r in result.Body
                                 select new PSVirtualMachineExtensionImage
                                 {
                                     RequestId = result.RequestId,
                                     StatusCode = result.Response.StatusCode,
                                     Id = r.Id,
                                     Location = r.Location,
                                     Version = r.Name,
                                     PublisherName = this.PublisherName,
                                     Type = this.Type,
                                     FilterExpression = this.FilterExpression
                                 };

                    WriteObject(images, true);
                }
                else
                {
                    var result = this.VirtualMachineExtensionImageClient.GetWithHttpMessagesAsync(
                        this.Location.Canonicalize(),
                        this.PublisherName,
                        this.Type,
                        this.Version).GetAwaiter().GetResult();


                    var image = new PSVirtualMachineExtensionImageDetails
                    {
                        RequestId = result.RequestId,
                        StatusCode = result.Response.StatusCode,
                        Id = result.Body.Id,
                        Location = result.Body.Location,
                        HandlerSchema = result.Body.HandlerSchema,
                        OperatingSystem = result.Body.OperatingSystem,
                        ComputeRole = result.Body.ComputeRole,
                        SupportsMultipleExtensions = result.Body.SupportsMultipleExtensions,
                        VMScaleSetEnabled = result.Body.VmScaleSetEnabled,
                        Version = result.Body.Name,
                        PublisherName = this.PublisherName,
                        Type = this.Type,
                        FilterExpression = this.FilterExpression
                    };

                    WriteObject(image);
                }
            });
        }