public virtual ArmOperation <ExchangeOperationResultResponse> PostExchange(WaitUntil waitUntil, ExchangeContent content, CancellationToken cancellationToken = default)
 {
     using var scope = ExchangeClientDiagnostics.CreateScope("TenantResourceExtensionClient.PostExchange");
     scope.Start();
     try
     {
         var response  = ExchangeRestClient.Post(content, cancellationToken);
         var operation = new ReservationsArmOperation <ExchangeOperationResultResponse>(new ExchangeOperationResultResponseOperationSource(), ExchangeClientDiagnostics, Pipeline, ExchangeRestClient.CreatePostRequest(content).Request, response, OperationFinalStateVia.AzureAsyncOperation);
         if (waitUntil == WaitUntil.Completed)
         {
             operation.WaitForCompletion(cancellationToken);
         }
         return(operation);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
예제 #2
0
        public virtual ArmOperation <AvailableScopeProperties> AvailableScopes(WaitUntil waitUntil, AvailableScopeContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(content, nameof(content));

            using var scope = _reservationResponseReservationClientDiagnostics.CreateScope("ReservationResponseResource.AvailableScopes");
            scope.Start();
            try
            {
                var response  = _reservationResponseReservationRestClient.AvailableScopes(Id.Parent.Name, Id.Name, content, cancellationToken);
                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)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
예제 #3
0
        public virtual ArmOperation <ReservationResponseResource> Update(WaitUntil waitUntil, ReservationResponsePatch patch, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(patch, nameof(patch));

            using var scope = _reservationResponseReservationClientDiagnostics.CreateScope("ReservationResponseResource.Update");
            scope.Start();
            try
            {
                var response  = _reservationResponseReservationRestClient.Update(Id.Parent.Name, Id.Name, patch, cancellationToken);
                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)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
예제 #4
0
        public virtual ArmOperation <CurrentQuotaLimitBaseResource> Update(WaitUntil waitUntil, CurrentQuotaLimitBaseData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseResource.Update");
            scope.Start();
            try
            {
                var response  = _currentQuotaLimitBaseQuotaRestClient.Update(Id.SubscriptionId, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken);
                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)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual ArmOperation <IList <ReservationResponseData> > MergeReservation(WaitUntil waitUntil, MergeContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(content, nameof(content));

            using var scope = _reservationResponseReservationClientDiagnostics.CreateScope("ReservationOrderResponseResource.MergeReservation");
            scope.Start();
            try
            {
                var response  = _reservationResponseReservationRestClient.Merge(Id.Name, content, cancellationToken);
                var operation = new ReservationsArmOperation <IList <ReservationResponseData> >(new IListOperationSource(), _reservationResponseReservationClientDiagnostics, Pipeline, _reservationResponseReservationRestClient.CreateMergeRequest(Id.Name, content).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual ArmOperation <ReservationOrderResponseResource> CreateOrUpdate(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  = _reservationOrderResponseReservationOrderRestClient.Purchase(reservationOrderId, content, cancellationToken);
                var operation = new ReservationsArmOperation <ReservationOrderResponseResource>(new ReservationOrderResponseOperationSource(Client), _reservationOrderResponseReservationOrderClientDiagnostics, Pipeline, _reservationOrderResponseReservationOrderRestClient.CreatePurchaseRequest(reservationOrderId, content).Request, response, OperationFinalStateVia.Location);
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }