Exemplo n.º 1
0
        public virtual async Task <ArmOperation <HciCluster> > CreateOrUpdateAsync(WaitUntil waitUntil, string clusterName, HciClusterData cluster, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName));
            Argument.AssertNotNull(cluster, nameof(cluster));

            using var scope = _hciClusterClustersClientDiagnostics.CreateScope("HciClusterCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _hciClusterClustersRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cluster, cancellationToken).ConfigureAwait(false);

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