Esempio n. 1
0
        public virtual async Task <ArmOperation <FluidRelayServerResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string fluidRelayServerName, FluidRelayServerData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(fluidRelayServerName, nameof(fluidRelayServerName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _fluidRelayServerClientDiagnostics.CreateScope("FluidRelayServerCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _fluidRelayServerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, fluidRelayServerName, data, cancellationToken).ConfigureAwait(false);

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