public async Task <Response <AzureFirewall> > GetAsync(string resourceGroupName, string azureFirewallName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (azureFirewallName == null) { throw new ArgumentNullException(nameof(azureFirewallName)); } using var message = CreateGetRequest(resourceGroupName, azureFirewallName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { AzureFirewall 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 = AzureFirewall.DeserializeAzureFirewall(document.RootElement); } return(Response.FromValue(value, message.Response)); }
public virtual AzureFirewallsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string azureFirewallName, AzureFirewall parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (azureFirewallName == null) { throw new ArgumentNullException(nameof(azureFirewallName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("AzureFirewallsOperations.StartCreateOrUpdate"); scope.Start(); try { var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, azureFirewallName, parameters, cancellationToken); return(new AzureFirewallsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, azureFirewallName, parameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }