public virtual ArmOperation <AuthConfigResource> Update(WaitUntil waitUntil, AuthConfigData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _authConfigContainerAppsAuthConfigsClientDiagnostics.CreateScope("AuthConfigResource.Update");
            scope.Start();
            try
            {
                var response  = _authConfigContainerAppsAuthConfigsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken);
                var operation = new ContainersArmOperation <AuthConfigResource>(Response.FromValue(new AuthConfigResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    operation.WaitForCompletion(cancellationToken);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #2
0
        public virtual async Task <ArmOperation <AuthConfigResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string name, AuthConfigData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _authConfigContainerAppsAuthConfigsClientDiagnostics.CreateScope("AuthConfigCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _authConfigContainerAppsAuthConfigsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false);

                var operation = new ContainersArmOperation <AuthConfigResource>(Response.FromValue(new AuthConfigResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 internal AuthConfigResource(ArmClient client, AuthConfigData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }