public virtual Response <VaultKeyVersionResource> Get(CancellationToken cancellationToken = default) { using var scope = _vaultKeyVersionKeysClientDiagnostics.CreateScope("VaultKeyVersionResource.Get"); scope.Start(); try { var response = _vaultKeyVersionKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VaultKeyVersionResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VaultKeyVersion> Get(string keyVersion, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(keyVersion, nameof(keyVersion)); using var scope = _vaultKeyVersionKeysClientDiagnostics.CreateScope("VaultKeyVersionCollection.Get"); scope.Start(); try { var response = _vaultKeyVersionKeysRestClient.GetVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, keyVersion, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VaultKeyVersion(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }