示例#1
0
 internal AutoscaleSettingResource(ArmClient client, AutoscaleSettingData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
示例#2
0
        public virtual async Task <ArmOperation <AutoscaleSettingResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string autoscaleSettingName, AutoscaleSettingData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(autoscaleSettingName, nameof(autoscaleSettingName));
            Argument.AssertNotNull(data, nameof(data));

            using var scope = _autoscaleSettingClientDiagnostics.CreateScope("AutoscaleSettingCollection.CreateOrUpdate");
            scope.Start();
            try
            {
                var response = await _autoscaleSettingRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, autoscaleSettingName, data, cancellationToken).ConfigureAwait(false);

                var operation = new MonitorArmOperation <AutoscaleSettingResource>(Response.FromValue(new AutoscaleSettingResource(Client, response), response.GetRawResponse()));
                if (waitUntil == WaitUntil.Completed)
                {
                    await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(operation);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }