Exemple #1
0
        public virtual async Task <ArmOperation <AppPlatformAppResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string appName, AppPlatformAppResourceData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(appName, nameof(appName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _appPlatformAppResourceAppsClientDiagnostics.CreateScope("AppPlatformAppResourceCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _appPlatformAppResourceAppsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appName, data, cancellationToken).ConfigureAwait(false);

                var operation = new AppPlatformArmOperation <AppPlatformAppResource>(new AppPlatformAppResourceOperationSource(Client), _appPlatformAppResourceAppsClientDiagnostics, Pipeline, _appPlatformAppResourceAppsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, appName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation);
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }