public virtual Response <ManagementLockResource> Get(string lockName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(lockName, nameof(lockName)); using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLockCollection.Get"); scope.Start(); try { var response = _managementLockRestClient.GetByScope(Id, lockName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ManagementLockResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ManagementLockResource> Get(CancellationToken cancellationToken = default) { using var scope = _managementLockClientDiagnostics.CreateScope("ManagementLockResource.Get"); scope.Start(); try { var response = _managementLockRestClient.GetByScope(Id.Parent, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ManagementLockResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }