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

            using var scope = _privateLinkScopeClientDiagnostics.CreateScope("PrivateLinkScopeCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _privateLinkScopeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, scopeName, data, cancellationToken).ConfigureAwait(false);

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