public virtual async Task <ArmOperation <ExchangeOperationResultResponse> > PostExchangeAsync(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default)
        {
            using var scope = ExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.PostExchange");
            scope.Start();
            try
            {
                var response = await ExchangeRestClient.PostAsync(content, cancellationToken).ConfigureAwait(false);

                var operation = new ReservationsArmOperation <ExchangeOperationResultResponse>(new ExchangeOperationResultResponseOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
        public virtual async Task <ArmOperation <AvailableScopeProperties> > AvailableScopesAsync(WaitUntil waitUntil, AvailableScopeContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(content, nameof(content));

            using var scope = _reservationResponseReservationClientDiagnostics.CreateScope("ReservationResponseResource.AvailableScopes");
            scope.Start();
            try
            {
                var response = await _reservationResponseReservationRestClient.AvailableScopesAsync(Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false);

                var operation = new ReservationsArmOperation <AvailableScopeProperties>(new AvailableScopePropertiesOperationSource(), _reservationResponseReservationClientDiagnostics, Pipeline, _reservationResponseReservationRestClient.CreateAvailableScopesRequest(Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #3
0
        public virtual async Task <ArmOperation <ReservationResponseResource> > UpdateAsync(WaitUntil waitUntil, ReservationResponsePatch patch, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(patch, nameof(patch));

            using var scope = _reservationResponseReservationClientDiagnostics.CreateScope("ReservationResponseResource.Update");
            scope.Start();
            try
            {
                var response = await _reservationResponseReservationRestClient.UpdateAsync(Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false);

                var operation = new ReservationsArmOperation <ReservationResponseResource>(new ReservationResponseOperationSource(Client), _reservationResponseReservationClientDiagnostics, Pipeline, _reservationResponseReservationRestClient.CreateUpdateRequest(Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #4
0
        public virtual async Task <ArmOperation <CurrentQuotaLimitBaseResource> > UpdateAsync(WaitUntil waitUntil, CurrentQuotaLimitBaseData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseResource.Update");
            scope.Start();
            try
            {
                var response = await _currentQuotaLimitBaseQuotaRestClient.UpdateAsync(Id.SubscriptionId, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false);

                var operation = new ReservationsArmOperation <CurrentQuotaLimitBaseResource>(new CurrentQuotaLimitBaseOperationSource(Client), _currentQuotaLimitBaseQuotaClientDiagnostics, Pipeline, _currentQuotaLimitBaseQuotaRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.OriginalUri);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual async Task <ArmOperation <ReservationOrderResponseResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string reservationOrderId, PurchaseRequestContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(reservationOrderId, nameof(reservationOrderId));
            Argument.AssertNotNull(content, nameof(content));

            using var scope = _reservationOrderResponseReservationOrderClientDiagnostics.CreateScope("ReservationOrderResponseCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _reservationOrderResponseReservationOrderRestClient.PurchaseAsync(reservationOrderId, content, cancellationToken).ConfigureAwait(false);

                var operation = new ReservationsArmOperation <ReservationOrderResponseResource>(new ReservationOrderResponseOperationSource(Client), _reservationOrderResponseReservationOrderClientDiagnostics, Pipeline, _reservationOrderResponseReservationOrderRestClient.CreatePurchaseRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }