4
public enum DeploymentDestinationAuthenticationType: Codable, CustomStringConvertible, Equatable, Hashable {
7
/// Absolute (arbitrary) path to a local key file.
8
case key(path: AbsolutePath)
10
// Look up a key inside ~/.ssh/
11
case keyInDefaultSshLocation(filename: String)
13
public var description: String {
16
return "password auth"
18
return "authorization using a key file at absolute path"
19
case .keyInDefaultSshLocation:
20
return "authorization using key from ~/.ssh/"
24
private enum CodingKeys: String, CodingKey {
30
public init(from decoder: Decoder) throws {
31
let container = try decoder.container(keyedBy: CodingKeys.self)
33
self = .password(try container.decode(String.self, forKey: .password))
36
self = .key(path: try container.decode(AbsolutePath.self, forKey: .keyPath))
38
self = .keyInDefaultSshLocation(filename: try container.decode(String.self, forKey: .filename))
44
public func encode(to encoder: Encoder) throws {
45
var container = encoder.container(keyedBy: CodingKeys.self)
47
case .password(let password):
48
try container.encode(password, forKey: .password)
50
try container.encode(path, forKey: .keyPath)
51
case .keyInDefaultSshLocation(let filename):
52
try container.encode(filename, forKey: .filename)