mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
refactor(apple): Decode all expected JSON fields from onUpdateResources (#5088)
We'll need these for display. Refs #3514
This commit is contained in:
@@ -12,12 +12,30 @@ public struct Resource: Decodable, Identifiable {
|
||||
public let id: String
|
||||
public var name: String
|
||||
public var address: String
|
||||
public var type: String
|
||||
public var addressDescription: String?
|
||||
public var status: ResourceStatus
|
||||
public var sites: [Site]
|
||||
public var type: ResourceType
|
||||
|
||||
public init(id: String, name: String, address: String, type: String) {
|
||||
public init(id: String, name: String, address: String, addressDescription: String?, status: ResourceStatus, sites: [Site], type: ResourceType) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.address = address
|
||||
self.addressDescription = addressDescription
|
||||
self.status = status
|
||||
self.sites = sites
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
public enum ResourceStatus: String, Decodable {
|
||||
case offline = "Offline"
|
||||
case online = "Online"
|
||||
case unknown = "Unknown"
|
||||
}
|
||||
|
||||
public enum ResourceType: String, Decodable {
|
||||
case dns = "dns"
|
||||
case cidr = "cidr"
|
||||
case ip = "ip"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Site.swift
|
||||
//
|
||||
//
|
||||
// Created by Jamil Bou Kheir on 5/21/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Site: Decodable, Identifiable {
|
||||
public let id: String
|
||||
public var name: String
|
||||
|
||||
public init(id: String, name: String) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user