public async Task <Response <NetworkProfile> > GetAsync(string resourceGroupName, string networkProfileName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (networkProfileName == null) { throw new ArgumentNullException(nameof(networkProfileName)); } using var message = CreateGetRequest(resourceGroupName, networkProfileName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { NetworkProfile value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = NetworkProfile.DeserializeNetworkProfile(document.RootElement); return(Response.FromValue(value, message.Response)); }
public virtual async Task <Response <NetworkProfile> > CreateOrUpdateAsync(string resourceGroupName, string networkProfileName, NetworkProfile parameters, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("NetworkProfilesOperations.CreateOrUpdate"); scope.Start(); try { return(await RestClient.CreateOrUpdateAsync(resourceGroupName, networkProfileName, parameters, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }