public static GitCredentials ConvertToGitCredentials(this GitCredentialSettings gitCredentialSettings) { return(gitCredentialSettings.Type switch { CredentialType.Ssh => (GitCredentials) new SshGitCredentials(gitCredentialSettings.Ssh.PrivateKey), CredentialType.UsernamePassword => new UsernamePasswordGitCredentials( gitCredentialSettings.UsernamePassword.Username, gitCredentialSettings.UsernamePassword.Password ) });
public static GitCredentials ConvertToGitCredentials(this GitCredentialSettings gitCredentialSettings) { return(gitCredentialSettings.Type switch { CredentialType.Ssh => (GitCredentials) new SshGitCredentials(gitCredentialSettings.Ssh.PrivateKey), CredentialType.UsernamePassword => new UsernamePasswordGitCredentials( gitCredentialSettings.UsernamePassword.Username, gitCredentialSettings.UsernamePassword.Password ), _ => throw new ArgumentOutOfRangeException() });