public async virtual Task <Response <VirtualMachineVirtualMachineExtension> > GetAsync(string vmExtensionName, string expand = null, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualMachineVirtualMachineExtensionCollection.Get"); scope.Start(); try { if (vmExtensionName == null) { throw new ArgumentNullException(nameof(vmExtensionName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, vmExtensionName, expand, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualMachineVirtualMachineExtension(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <VirtualMachineExtension> > GetAsync(string expand = null, CancellationToken cancellationToken = default) { using var scope = _virtualMachineExtensionClientDiagnostics.CreateScope("VirtualMachineExtension.Get"); scope.Start(); try { var response = await _virtualMachineExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachineExtension(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }