add examples to response

This commit is contained in:
Pascal Fischer
2023-05-05 18:00:13 +02:00
parent 2b65de30e4
commit adf57d5294
16 changed files with 1174 additions and 180 deletions

View File

@@ -158,7 +158,7 @@
"/api/users" : {
"get" : {
"tags" : [ "Users" ],
"summary" : "Retrieve Users",
"summary" : "List all Users",
"description" : "Returns a list of all users",
"operationId" : "getUsers",
"parameters" : [ {
@@ -2325,7 +2325,8 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Account ID"
"description" : "Account ID",
"example" : "ch8i4ug6lnn4g9hqv7l0"
},
"settings" : {
"$ref" : "#/components/schemas/AccountSettings"
@@ -2337,11 +2338,13 @@
"properties" : {
"peer_login_expiration_enabled" : {
"type" : "boolean",
"description" : "Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login)."
"description" : "Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login).",
"example" : true
},
"peer_login_expiration" : {
"type" : "integer",
"description" : "Period of time after which peer login expires (seconds)."
"description" : "Period of time after which peer login expires (seconds).",
"example" : 43200
}
}
},
@@ -2351,41 +2354,49 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "User ID"
"description" : "User ID",
"example" : "google-oauth2|277474792786460067937"
},
"email" : {
"type" : "string",
"description" : "User's email address"
"description" : "User's email address",
"example" : "demo@netbird.io"
},
"name" : {
"type" : "string",
"description" : "User's name from idp provider"
"description" : "User's name from idp provider",
"example" : "Tom Schulz"
},
"role" : {
"type" : "string",
"description" : "User's NetBird account role"
"description" : "User's NetBird account role",
"example" : "admin"
},
"status" : {
"type" : "string",
"description" : "User's status",
"example" : "active",
"enum" : [ "active", "invited", "disabled" ]
},
"auto_groups" : {
"type" : "array",
"description" : "Groups to auto-assign to peers registered by this user",
"items" : {
"type" : "string"
"type" : "string",
"example" : "devs"
}
},
"is_current" : {
"type" : "boolean",
"description" : "Is true if authenticated user is the same as this user",
"readOnly" : true
"readOnly" : true,
"example" : true
},
"is_service_user" : {
"type" : "boolean",
"description" : "Is true if this user is a service user",
"readOnly" : true
"readOnly" : true,
"example" : false
}
}
},
@@ -2395,13 +2406,15 @@
"properties" : {
"role" : {
"type" : "string",
"description" : "User's NetBird account role"
"description" : "User's NetBird account role",
"example" : "admin"
},
"auto_groups" : {
"type" : "array",
"description" : "Groups to auto-assign to peers registered by this user",
"items" : {
"type" : "string"
"type" : "string",
"example" : "devs"
}
}
}
@@ -2412,26 +2425,31 @@
"properties" : {
"email" : {
"type" : "string",
"description" : "User's Email to send invite to"
"description" : "User's Email to send invite to",
"example" : "demo@netbird.io"
},
"name" : {
"type" : "string",
"description" : "User's full name"
"description" : "User's full name",
"example" : "Tom Schulz"
},
"role" : {
"type" : "string",
"description" : "User's NetBird account role"
"description" : "User's NetBird account role",
"example" : "admin"
},
"auto_groups" : {
"type" : "array",
"description" : "Groups to auto-assign to peers registered by this user",
"items" : {
"type" : "string"
"type" : "string",
"example" : "devs"
}
},
"is_service_user" : {
"type" : "boolean",
"description" : "Is true if this user is a service user"
"description" : "Is true if this user is a service user",
"example" : false
}
}
},
@@ -2441,11 +2459,13 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Peer ID"
"description" : "Peer ID",
"example" : "chacbco6lnnbn6cg5s90"
},
"name" : {
"type" : "string",
"description" : "Peer's hostname"
"description" : "Peer's hostname",
"example" : "stage-host-1"
}
}
},
@@ -2454,13 +2474,16 @@
"type" : "object",
"properties" : {
"name" : {
"type" : "string"
"type" : "string",
"example" : "stage-host-1"
},
"ssh_enabled" : {
"type" : "boolean"
"type" : "boolean",
"example" : true
},
"login_expiration_enabled" : {
"type" : "boolean"
"type" : "boolean",
"example" : false
}
}
},
@@ -2473,24 +2496,29 @@
"properties" : {
"ip" : {
"type" : "string",
"description" : "Peer's IP address"
"description" : "Peer's IP address",
"example" : "10.64.0.1"
},
"connected" : {
"type" : "boolean",
"description" : "Peer to Management connection status"
"description" : "Peer to Management connection status",
"example" : true
},
"last_seen" : {
"type" : "string",
"description" : "Last time peer connected to Netbird's management service",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T10:05:26.420578Z"
},
"os" : {
"type" : "string",
"description" : "Peer's operating system and version"
"description" : "Peer's operating system and version",
"example" : "Darwin 13.2.1"
},
"version" : {
"type" : "string",
"description" : "Peer's daemon or cli version"
"description" : "Peer's daemon or cli version",
"example" : "0.14.0"
},
"groups" : {
"type" : "array",
@@ -2501,36 +2529,44 @@
},
"ssh_enabled" : {
"type" : "boolean",
"description" : "Indicates whether SSH server is enabled on this peer"
"description" : "Indicates whether SSH server is enabled on this peer",
"example" : true
},
"user_id" : {
"type" : "string",
"description" : "User ID of the user that enrolled this peer"
"description" : "User ID of the user that enrolled this peer",
"example" : "google-oauth2|277474792786460067937"
},
"hostname" : {
"type" : "string",
"description" : "Hostname of the machine"
"description" : "Hostname of the machine",
"example" : "stage-host-1"
},
"ui_version" : {
"type" : "string",
"description" : "Peer's desktop UI version"
"description" : "Peer's desktop UI version",
"example" : "0.14.0"
},
"dns_label" : {
"type" : "string",
"description" : "Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud"
"description" : "Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud",
"example" : "stage-host-1.netbird.cloud"
},
"login_expiration_enabled" : {
"type" : "boolean",
"description" : "Indicates whether peer login expiration has been enabled or not"
"description" : "Indicates whether peer login expiration has been enabled or not",
"example" : false
},
"login_expired" : {
"type" : "boolean",
"description" : "Indicates whether peer's login expired or not"
"description" : "Indicates whether peer's login expired or not",
"example" : false
},
"last_login" : {
"type" : "string",
"description" : "Last time this peer performed log in (authentication). E.g., user authenticated.",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
}
}
} ]
@@ -2541,61 +2577,74 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Setup Key ID"
"description" : "Setup Key ID",
"example" : "2531583362"
},
"key" : {
"type" : "string",
"description" : "Setup Key value"
"description" : "Setup Key value",
"example" : "A616097E-FCF0-48FA-9354-CA4A61142761"
},
"name" : {
"type" : "string",
"description" : "Setup key name identifier"
"description" : "Setup key name identifier",
"example" : "Default key"
},
"expires" : {
"type" : "string",
"description" : "Setup Key expiration date",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-06-01T14:47:22.291057Z"
},
"type" : {
"type" : "string",
"description" : "Setup key type, one-off for single time usage and reusable"
"description" : "Setup key type, one-off for single time usage and reusable",
"example" : "reusable"
},
"valid" : {
"type" : "boolean",
"description" : "Setup key validity status"
"description" : "Setup key validity status",
"example" : true
},
"revoked" : {
"type" : "boolean",
"description" : "Setup key revocation status"
"description" : "Setup key revocation status",
"example" : false
},
"used_times" : {
"type" : "integer",
"description" : "Usage count of setup key"
"description" : "Usage count of setup key",
"example" : 2
},
"last_used" : {
"type" : "string",
"description" : "Setup key last usage date",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
},
"state" : {
"type" : "string",
"description" : "Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\""
"description" : "Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\"",
"example" : "valid"
},
"auto_groups" : {
"type" : "array",
"description" : "Setup key groups to auto-assign to peers registered with this key",
"items" : {
"type" : "string"
"type" : "string",
"example" : "devs"
}
},
"updated_at" : {
"type" : "string",
"description" : "Setup key last update date",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
},
"usage_limit" : {
"type" : "integer",
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage."
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage.",
"example" : 0
}
}
},
@@ -2605,30 +2654,36 @@
"properties" : {
"name" : {
"type" : "string",
"description" : "Setup Key name"
"description" : "Setup Key name",
"example" : "Default key"
},
"type" : {
"type" : "string",
"description" : "Setup key type, one-off for single time usage and reusable"
"description" : "Setup key type, one-off for single time usage and reusable",
"example" : "reusable"
},
"expires_in" : {
"type" : "integer",
"description" : "Expiration time in seconds"
"description" : "Expiration time in seconds",
"example" : 43200
},
"revoked" : {
"type" : "boolean",
"description" : "Setup key revocation status"
"description" : "Setup key revocation status",
"example" : false
},
"auto_groups" : {
"type" : "array",
"description" : "Setup key groups to auto-assign to peers registered with this key",
"items" : {
"type" : "string"
"type" : "string",
"example" : "devs"
}
},
"usage_limit" : {
"type" : "integer",
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage."
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage.",
"example" : 0
}
}
},
@@ -2638,30 +2693,36 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "ID of a token"
"description" : "ID of a token",
"example" : "ch8i54g6lnn4g9hqv7n0"
},
"name" : {
"type" : "string",
"description" : "Name of the token"
"description" : "Name of the token",
"example" : "My first token"
},
"expiration_date" : {
"type" : "string",
"description" : "Date the token expires",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T14:38:28.977616Z"
},
"created_by" : {
"type" : "string",
"description" : "User ID of the user who created the token"
"description" : "User ID of the user who created the token",
"example" : "google-oauth2|277474792786460067937"
},
"created_at" : {
"type" : "string",
"description" : "Date the token was created",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-02T14:48:20.465209Z"
},
"last_used" : {
"type" : "string",
"description" : "Date the token was last used",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-04T12:45:25.9723616Z"
}
}
},
@@ -2671,7 +2732,8 @@
"properties" : {
"plain_token" : {
"type" : "string",
"description" : "Plain text representation of the generated token"
"description" : "Plain text representation of the generated token",
"example" : "2023-05-02T14:48:20.465209Z"
},
"personal_access_token" : {
"$ref" : "#/components/schemas/PersonalAccessToken"
@@ -2684,13 +2746,15 @@
"properties" : {
"name" : {
"type" : "string",
"description" : "Name of the token"
"description" : "Name of the token",
"example" : "My first token"
},
"expires_in" : {
"maximum" : 365,
"minimum" : 1,
"type" : "integer",
"description" : "Expiration in days"
"description" : "Expiration in days",
"example" : 30
}
}
},
@@ -2700,15 +2764,18 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Group ID"
"description" : "Group ID",
"example" : "ch8i4ug6lnn4g9hqv7m0"
},
"name" : {
"type" : "string",
"description" : "Group Name identifier"
"description" : "Group Name identifier",
"example" : "devs"
},
"peers_count" : {
"type" : "integer",
"description" : "Count of peers associated to the group"
"description" : "Count of peers associated to the group",
"example" : 2
}
}
},
@@ -2718,11 +2785,13 @@
"properties" : {
"name" : {
"type" : "string",
"description" : "Group name identifier"
"description" : "Group name identifier",
"example" : "devs"
},
"peers" : {
"type" : "array",
"description" : "List of peers ids",
"example" : "ch8i4ug6lnn4g9hqv7m1",
"items" : {
"type" : "string"
}
@@ -2752,19 +2821,23 @@
"properties" : {
"name" : {
"type" : "string",
"description" : "Rule name identifier"
"description" : "Rule name identifier",
"example" : "Default"
},
"description" : {
"type" : "string",
"description" : "Rule friendly description"
"description" : "Rule friendly description",
"example" : "This is a default rule that allows connections between all the resources"
},
"disabled" : {
"type" : "boolean",
"description" : "Rules status"
"description" : "Rules status",
"example" : false
},
"flow" : {
"type" : "string",
"description" : "Rule flow, currently, only \"bidirect\" for bi-directional traffic is accepted"
"description" : "Rule flow, currently, only \"bidirect\" for bi-directional traffic is accepted",
"example" : "bidirect"
}
}
},
@@ -2778,14 +2851,16 @@
"type" : "array",
"description" : "List of source groups",
"items" : {
"type" : "string"
"type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m1"
}
},
"destinations" : {
"type" : "array",
"description" : "List of destination groups",
"items" : {
"type" : "string"
"type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
}
}
}
@@ -2798,7 +2873,8 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Rule ID"
"description" : "Rule ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
}
}
}, {
@@ -2830,19 +2906,23 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Rule ID"
"description" : "Rule ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
},
"name" : {
"type" : "string",
"description" : "Rule name identifier"
"description" : "Rule name identifier",
"example" : "Default"
},
"description" : {
"type" : "string",
"description" : "Rule friendly description"
"description" : "Rule friendly description",
"example" : "This is a default rule that allows connections between all the resources"
},
"enabled" : {
"type" : "boolean",
"description" : "Rules status"
"description" : "Rules status",
"example" : true
},
"sources" : {
"type" : "array",
@@ -2861,6 +2941,7 @@
"action" : {
"type" : "string",
"description" : "policy accept or drops packets",
"example" : "accept",
"enum" : [ "accept", "drop" ]
}
}
@@ -2871,19 +2952,23 @@
"properties" : {
"name" : {
"type" : "string",
"description" : "Policy name identifier"
"description" : "Policy name identifier",
"example" : "ch8i4ug6lnn4g9hqv7mg"
},
"description" : {
"type" : "string",
"description" : "Policy friendly description"
"description" : "Policy friendly description",
"example" : "This is a default policy that allows connections between all the resources"
},
"enabled" : {
"type" : "boolean",
"description" : "Policy status"
"description" : "Policy status",
"example" : true
},
"query" : {
"type" : "string",
"description" : "Policy Rego query"
"description" : "Policy Rego query",
"example" : "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n"
},
"rules" : {
"type" : "array",
@@ -2903,7 +2988,8 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Policy ID"
"description" : "Policy ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
}
}
} ]
@@ -2914,41 +3000,49 @@
"properties" : {
"description" : {
"type" : "string",
"description" : "Route description"
"description" : "Route description",
"example" : "My first route"
},
"network_id" : {
"maxLength" : 40,
"minLength" : 1,
"type" : "string",
"description" : "Route network identifier, to group HA routes"
"description" : "Route network identifier, to group HA routes",
"example" : "Route 1"
},
"enabled" : {
"type" : "boolean",
"description" : "Route status"
"description" : "Route status",
"example" : true
},
"peer" : {
"type" : "string",
"description" : "Peer Identifier associated with route"
"description" : "Peer Identifier associated with route",
"example" : "chacbco6lnnbn6cg5s91"
},
"network" : {
"type" : "string",
"description" : "Network range in CIDR format"
"description" : "Network range in CIDR format",
"example" : "10.64.0.0/24"
},
"metric" : {
"maximum" : 9999,
"minimum" : 1,
"type" : "integer",
"description" : "Route metric number. Lowest number has higher priority"
"description" : "Route metric number. Lowest number has higher priority",
"example" : 9999
},
"masquerade" : {
"type" : "boolean",
"description" : "Indicate if peer should masquerade traffic to this route's prefix"
"description" : "Indicate if peer should masquerade traffic to this route's prefix",
"example" : true
},
"groups" : {
"type" : "array",
"description" : "Route group tag groups",
"items" : {
"type" : "string"
"type" : "string",
"example" : "chacdk86lnnboviihd70"
}
}
}
@@ -2960,11 +3054,13 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Route Id"
"description" : "Route Id",
"example" : "chacdk86lnnboviihd7g"
},
"network_type" : {
"type" : "string",
"description" : "Network type indicating if it is IPv4 or IPv6"
"description" : "Network type indicating if it is IPv4 or IPv6",
"example" : "IPv4"
}
}
}, {
@@ -2977,16 +3073,19 @@
"properties" : {
"ip" : {
"type" : "string",
"description" : "Nameserver IP"
"description" : "Nameserver IP",
"example" : "8.8.8.8"
},
"ns_type" : {
"type" : "string",
"description" : "Nameserver Type",
"example" : "udp",
"enum" : [ "udp" ]
},
"port" : {
"type" : "integer",
"description" : "Nameserver Port"
"description" : "Nameserver Port",
"example" : 53
}
}
},
@@ -2998,11 +3097,13 @@
"maxLength" : 40,
"minLength" : 1,
"type" : "string",
"description" : "Nameserver group name"
"description" : "Nameserver group name",
"example" : "Google DNS"
},
"description" : {
"type" : "string",
"description" : "Nameserver group description"
"description" : "Nameserver group description",
"example" : "Google DNS servers"
},
"nameservers" : {
"maxLength" : 2,
@@ -3015,18 +3116,21 @@
},
"enabled" : {
"type" : "boolean",
"description" : "Nameserver group status"
"description" : "Nameserver group status",
"example" : true
},
"groups" : {
"type" : "array",
"description" : "Nameserver group tag groups",
"items" : {
"type" : "string"
"type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
}
},
"primary" : {
"type" : "boolean",
"description" : "Nameserver group primary status"
"description" : "Nameserver group primary status",
"example" : true
},
"domains" : {
"type" : "array",
@@ -3034,7 +3138,8 @@
"items" : {
"maxLength" : 255,
"minLength" : 1,
"type" : "string"
"type" : "string",
"example" : "example.com"
}
}
}
@@ -3046,7 +3151,8 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Nameserver group ID"
"description" : "Nameserver group ID",
"example" : "ch8i4ug6lnn4g9hqv7m0"
}
}
}, {
@@ -3061,7 +3167,8 @@
"type" : "array",
"description" : "Groups whose DNS management is disabled",
"items" : {
"type" : "string"
"type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
}
}
}
@@ -3072,36 +3179,47 @@
"properties" : {
"id" : {
"type" : "string",
"description" : "Event unique identifier"
"description" : "Event unique identifier",
"example" : "10"
},
"timestamp" : {
"type" : "string",
"description" : "The date and time when the event occurred",
"format" : "date-time"
"format" : "date-time",
"example" : "2023-05-05T10:04:37.473542Z"
},
"activity" : {
"type" : "string",
"description" : "The activity that occurred during the event"
"description" : "The activity that occurred during the event",
"example" : "Route created"
},
"activity_code" : {
"type" : "string",
"description" : "The string code of the activity that occurred during the event",
"example" : "route.add",
"enum" : [ "user.peer.delete", "user.join", "user.invite", "user.peer.add", "user.group.add", "user.group.delete", "user.role.update", "setupkey.peer.add", "setupkey.add", "setupkey.update", "setupkey.revoke", "setupkey.overuse", "setupkey.group.delete", "setupkey.group.add", "rule.add", "rule.delete", "rule.update", "policy.add", "policy.delete", "policy.update", "group.add", "group.update", "dns.setting.disabled.management.group.add", "dns.setting.disabled.management.group.delete", "account.create", "account.setting.peer.login.expiration.update", "account.setting.peer.login.expiration.disable", "account.setting.peer.login.expiration.enable", "route.add", "route.delete", "route.update", "nameserver.group.add", "nameserver.group.delete", "nameserver.group.update", "peer.ssh.disable", "peer.ssh.enable", "peer.rename", "peer.login.expiration.disable", "peer.login.expiration.enable", "service.user.create", "personal.access.token.create", "service.user.delete", "personal.access.token.delete" ]
},
"initiator_id" : {
"type" : "string",
"description" : "The ID of the initiator of the event. E.g., an ID of a user that triggered the event."
"description" : "The ID of the initiator of the event. E.g., an ID of a user that triggered the event.",
"example" : "google-oauth2|123456789012345678901"
},
"target_id" : {
"type" : "string",
"description" : "The ID of the target of the event. E.g., an ID of the peer that a user removed."
"description" : "The ID of the target of the event. E.g., an ID of the peer that a user removed.",
"example" : "chad9d86lnnc59g18ou0"
},
"meta" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
},
"description" : "The metadata of the event"
"description" : "The metadata of the event",
"example" : {
"name" : "my route",
"network_range" : "10.64.0.0/24",
"peer_id" : "chacbco6lnnbn6cg5s91"
}
}
}
}