public override void ExecuteCmdlet()

in src/PowerShell/Commands/GetPartnerProductSku.cs [71:125]


        public override void ExecuteCmdlet()
        {
            Scheduler.RunTask(async () =>
            {
                IPartner partner = await PartnerSession.Instance.ClientFactory.CreatePartnerOperationsAsync(CorrelationId, CancellationToken).ConfigureAwait(false);
                IProductCollectionByCountry operations = partner.Products.ByCountry(string.IsNullOrEmpty(CountryCode) ? PartnerSession.Instance.Context.CountryCode : CountryCode);

                if (ParameterSetName == ByProductIdParameterSetName)
                {
                    ResourceCollection<Sku> skus;

                    if (string.IsNullOrEmpty(ReservationScope))
                    {
                        skus = await operations.ById(ProductId).Skus.GetAsync(CancellationToken).ConfigureAwait(false);
                    }
                    else
                    {
                        skus = await operations.ById(ProductId).Skus.ByReservationScope(ReservationScope).GetAsync(CancellationToken).ConfigureAwait(false);
                    }

                    WriteObject(skus.Items.Select(s => new PSSku(s)), true);
                }
                else if (ParameterSetName == BySkuIdParameterSetName)
                {
                    Sku sku;

                    if (string.IsNullOrEmpty(ReservationScope))
                    {
                        sku = await operations.ById(ProductId).Skus.ById(SkuId).GetAsync(CancellationToken).ConfigureAwait(false);
                    }
                    else
                    {
                        sku = await operations.ById(ProductId).Skus.ById(SkuId).ByReservationScope(ReservationScope).GetAsync(CancellationToken).ConfigureAwait(false);
                    }

                    WriteObject(new PSSku(sku));

                }
                else if (ParameterSetName == BySegmentParameterSetName)
                {
                    ResourceCollection<Sku> skus;

                    if (string.IsNullOrEmpty(ReservationScope))
                    {
                        skus = await operations.ById(ProductId).Skus.ByTargetSegment(Segment).GetAsync(CancellationToken).ConfigureAwait(false);
                    }
                    else
                    {
                        skus = await operations.ById(ProductId).Skus.ByTargetSegment(Segment).ByReservationScope(ReservationScope).GetAsync(CancellationToken).ConfigureAwait(false);
                    }

                    WriteObject(skus.Items.Select(s => new PSSku(s)), true);
                }
            }, true);
        }