public async Task <Response <ExpressRouteCircuitAuthorization> > GetAsync(string resourceGroupName, string circuitName, string authorizationName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (circuitName == null) { throw new ArgumentNullException(nameof(circuitName)); } if (authorizationName == null) { throw new ArgumentNullException(nameof(authorizationName)); } using var message = CreateGetRequest(resourceGroupName, circuitName, authorizationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ExpressRouteCircuitAuthorization value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = ExpressRouteCircuitAuthorization.DeserializeExpressRouteCircuitAuthorization(document.RootElement); } return(Response.FromValue(value, message.Response)); }
public virtual ExpressRouteCircuitAuthorizationsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string circuitName, string authorizationName, ExpressRouteCircuitAuthorization authorizationParameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (circuitName == null) { throw new ArgumentNullException(nameof(circuitName)); } if (authorizationName == null) { throw new ArgumentNullException(nameof(authorizationName)); } if (authorizationParameters == null) { throw new ArgumentNullException(nameof(authorizationParameters)); } using var scope = _clientDiagnostics.CreateScope("ExpressRouteCircuitAuthorizationsOperations.StartCreateOrUpdate"); scope.Start(); try { var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancellationToken); return(new ExpressRouteCircuitAuthorizationsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, circuitName, authorizationName, authorizationParameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }