public virtual Response <VirtualMachineExtension> Get(string expand = null, CancellationToken cancellationToken = default) { using var scope = _virtualMachineExtensionClientDiagnostics.CreateScope("VirtualMachineExtension.Get"); scope.Start(); try { var response = _virtualMachineExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); 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; } }
public virtual Response <VirtualMachineVirtualMachineExtension> Get(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 = _restClient.Get(Id.ResourceGroupName, Id.Name, vmExtensionName, expand, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualMachineVirtualMachineExtension(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }