CurrentQuotaLimitBaseResource IOperationSource <CurrentQuotaLimitBaseResource> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = CurrentQuotaLimitBaseData.DeserializeCurrentQuotaLimitBaseData(document.RootElement); return(new CurrentQuotaLimitBaseResource(_client, data)); }
public async Task <Response <CurrentQuotaLimitBaseData> > GetAsync(string subscriptionId, string providerId, string location, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(providerId, nameof(providerId)); Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); using var message = CreateGetRequest(subscriptionId, providerId, location, resourceName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { CurrentQuotaLimitBaseData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = CurrentQuotaLimitBaseData.DeserializeCurrentQuotaLimitBaseData(document.RootElement); return(Response.FromValue(value, message.Response)); }
public virtual async Task <ArmOperation <CurrentQuotaLimitBaseResource> > CreateOrUpdateAsync(WaitUntil waitUntil, string resourceName, CurrentQuotaLimitBaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseCollection.CreateOrUpdate"); scope.Start(); try { var response = await _currentQuotaLimitBaseQuotaRestClient.CreateOrUpdateAsync(Id.SubscriptionId, _providerId, _location, resourceName, data, cancellationToken).ConfigureAwait(false); var operation = new ReservationsArmOperation <CurrentQuotaLimitBaseResource>(new CurrentQuotaLimitBaseOperationSource(Client), _currentQuotaLimitBaseQuotaClientDiagnostics, Pipeline, _currentQuotaLimitBaseQuotaRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, _providerId, _location, resourceName, data).Request, response, OperationFinalStateVia.OriginalUri); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal CurrentQuotaLimitBaseResource(ArmClient client, CurrentQuotaLimitBaseData data) : this(client, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <CurrentQuotaLimitBaseResource> Update(WaitUntil waitUntil, CurrentQuotaLimitBaseData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _currentQuotaLimitBaseQuotaClientDiagnostics.CreateScope("CurrentQuotaLimitBaseResource.Update"); scope.Start(); try { var response = _currentQuotaLimitBaseQuotaRestClient.Update(Id.SubscriptionId, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); var operation = new ReservationsArmOperation <CurrentQuotaLimitBaseResource>(new CurrentQuotaLimitBaseOperationSource(Client), _currentQuotaLimitBaseQuotaClientDiagnostics, Pipeline, _currentQuotaLimitBaseQuotaRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.OriginalUri); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }