/// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            SupportContact contact;

            try
            {
                if (ShouldProcess(string.Format(
                                      CultureInfo.CurrentCulture,
                                      Resources.SetPartnerCustomerSubscriptionSupportContactWhatIf,
                                      SubscriptionId)))
                {
                    contact = new SupportContact
                    {
                        Name            = Name,
                        SupportMpnId    = SupportMpnId,
                        SupportTenantId = SupportTenantId
                    };

                    contact = Partner.Customers[CustomerId].Subscriptions[SubscriptionId].SupportContact.Update(contact);
                    WriteObject(new PSSupportContact(contact));
                }
            }
            finally
            {
                contact = null;
            }
        }
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            Scheduler.RunTask(async() =>
            {
                IPartner partner       = await PartnerSession.Instance.ClientFactory.CreatePartnerOperationsAsync(CorrelationId, CancellationToken).ConfigureAwait(false);
                SupportContact contact = await partner.Customers[CustomerId].Subscriptions[SubscriptionId].SupportContact.GetAsync(CancellationToken).ConfigureAwait(false);

                WriteObject(new PSSupportContact(contact));
            }, true);
        }
        /// <summary>
        /// Updates the support contact of the customer's subscription.
        /// </summary>
        /// <param name="supportContact">The support contact.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The updated support contact.</returns>
        public async Task <SupportContact> UpdateAsync(SupportContact entity, CancellationToken cancellationToken = default)
        {
            entity.AssertNotNull(nameof(entity));

            return(await Partner.ServiceClient.PutAsync <SupportContact, SupportContact>(
                       new Uri(
                           string.Format(
                               CultureInfo.InvariantCulture,
                               $"/{PartnerService.Instance.ApiVersion}/{PartnerService.Instance.Configuration.Apis.UpdateSubscriptionSupportContact.Path}",
                               Context.Item1,
                               Context.Item2),
                           UriKind.Relative),
                       entity,
                       cancellationToken).ConfigureAwait(false));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            Scheduler.RunTask(async() =>
            {
                if (ShouldProcess(string.Format(
                                      CultureInfo.CurrentCulture,
                                      Resources.SetPartnerCustomerSubscriptionSupportContactWhatIf,
                                      SubscriptionId)))
                {
                    IPartner partner       = await PartnerSession.Instance.ClientFactory.CreatePartnerOperationsAsync(CorrelationId, CancellationToken).ConfigureAwait(false);
                    SupportContact contact = new SupportContact
                    {
                        Name            = Name,
                        SupportMpnId    = SupportMpnId,
                        SupportTenantId = SupportTenantId
                    };

                    contact = await partner.Customers[CustomerId].Subscriptions[SubscriptionId].SupportContact.UpdateAsync(contact, CancellationToken).ConfigureAwait(false);
                    WriteObject(new PSSupportContact(contact));
                }
            }, true);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PSSupportContact" /> class.
 /// </summary>
 /// <param name="subscription">The base contact for this instance.</param>
 public PSSupportContact(SupportContact contact)
 {
     this.CopyFrom(contact);
 }
        /// <summary>
        /// Executes the operations associated with the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            SupportContact contact = Partner.Customers[CustomerId].Subscriptions[SubscriptionId].SupportContact.GetAsync().GetAwaiter().GetResult();

            WriteObject(new PSSupportContact(contact));
        }
Ejemplo n.º 7
0
 internal static void GetSupportSettings(AdminCenterClient adminCenterClient, string environmentName)
 {
     SupportContact supportContact = adminCenterClient.GetSupportContactInformation("BusinessCentral", environmentName);
     Utils.ConsoleWriteLineAsJson(supportContact);
 }