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

@@ -36,6 +36,7 @@ components:
id:
description: Account ID
type: string
example: ch8i4ug6lnn4g9hqv7l0
settings:
$ref: '#/components/schemas/AccountSettings'
required:
@@ -46,9 +47,11 @@ components:
peer_login_expiration_enabled:
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).
type: boolean
example: true
peer_login_expiration:
description: Period of time after which peer login expires (seconds).
type: integer
example: 43200
required:
- peer_login_expiration_enabled
- peer_login_expiration
@@ -58,32 +61,40 @@ components:
id:
description: User ID
type: string
example: google-oauth2|277474792786460067937
email:
description: User's email address
type: string
example: demo@netbird.io
name:
description: User's name from idp provider
type: string
example: Tom Schulz
role:
description: User's NetBird account role
type: string
example: admin
status:
description: User's status
type: string
enum: [ "active","invited","disabled" ]
example: active
auto_groups:
description: Groups to auto-assign to peers registered by this user
type: array
items:
type: string
example: devs
is_current:
description: Is true if authenticated user is the same as this user
type: boolean
readOnly: true
example: true
is_service_user:
description: Is true if this user is a service user
type: boolean
readOnly: true
example: false
required:
- id
- email
@@ -97,11 +108,13 @@ components:
role:
description: User's NetBird account role
type: string
example: admin
auto_groups:
description: Groups to auto-assign to peers registered by this user
type: array
items:
type: string
example: devs
required:
- role
- auto_groups
@@ -111,20 +124,25 @@ components:
email:
description: User's Email to send invite to
type: string
example: demo@netbird.io
name:
description: User's full name
type: string
example: Tom Schulz
role:
description: User's NetBird account role
type: string
example: admin
auto_groups:
description: Groups to auto-assign to peers registered by this user
type: array
items:
type: string
example: devs
is_service_user:
description: Is true if this user is a service user
type: boolean
example: false
required:
- role
- auto_groups
@@ -135,9 +153,11 @@ components:
id:
description: Peer ID
type: string
example: chacbco6lnnbn6cg5s90
name:
description: Peer's hostname
type: string
example: stage-host-1
required:
- id
- name
@@ -146,10 +166,13 @@ components:
properties:
name:
type: string
example: stage-host-1
ssh_enabled:
type: boolean
example: true
login_expiration_enabled:
type: boolean
example: false
required:
- name
- ssh_enabled
@@ -162,19 +185,24 @@ components:
ip:
description: Peer's IP address
type: string
example: 10.64.0.1
connected:
description: Peer to Management connection status
type: boolean
example: true
last_seen:
description: Last time peer connected to Netbird's management service
type: string
format: date-time
example: 2023-05-05T10:05:26.420578Z
os:
description: Peer's operating system and version
type: string
example: Darwin 13.2.1
version:
description: Peer's daemon or cli version
type: string
example: 0.14.0
groups:
description: Groups that the peer belongs to
type: array
@@ -183,28 +211,36 @@ components:
ssh_enabled:
description: Indicates whether SSH server is enabled on this peer
type: boolean
example: true
user_id:
description: User ID of the user that enrolled this peer
type: string
example: google-oauth2|277474792786460067937
hostname:
description: Hostname of the machine
type: string
example: stage-host-1
ui_version:
description: Peer's desktop UI version
type: string
example: 0.14.0
dns_label:
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
type: string
example: stage-host-1.netbird.cloud
login_expiration_enabled:
description: Indicates whether peer login expiration has been enabled or not
type: boolean
example: false
login_expired:
description: Indicates whether peer's login expired or not
type: boolean
example: false
last_login:
description: Last time this peer performed log in (authentication). E.g., user authenticated.
type: string
format: date-time
example: 2023-05-05T09:00:35.477782Z
required:
- ip
- connected
@@ -224,47 +260,60 @@ components:
id:
description: Setup Key ID
type: string
example: 2531583362
key:
description: Setup Key value
type: string
example: A616097E-FCF0-48FA-9354-CA4A61142761
name:
description: Setup key name identifier
type: string
example: Default key
expires:
description: Setup Key expiration date
type: string
format: date-time
example: 2023-06-01T14:47:22.291057Z
type:
description: Setup key type, one-off for single time usage and reusable
type: string
example: reusable
valid:
description: Setup key validity status
type: boolean
example: true
revoked:
description: Setup key revocation status
type: boolean
example: false
used_times:
description: Usage count of setup key
type: integer
example: 2
last_used:
description: Setup key last usage date
type: string
format: date-time
example: 2023-05-05T09:00:35.477782Z
state:
description: Setup key status, "valid", "overused","expired" or "revoked"
type: string
example: valid
auto_groups:
description: Setup key groups to auto-assign to peers registered with this key
type: array
items:
type: string
example: "devs"
updated_at:
description: Setup key last update date
type: string
format: date-time
example: 2023-05-05T09:00:35.477782Z
usage_limit:
description: A number of times this key can be used. The value of 0 indicates the unlimited usage.
type: integer
example: 0
required:
- id
- key
@@ -285,23 +334,29 @@ components:
name:
description: Setup Key name
type: string
example: Default key
type:
description: Setup key type, one-off for single time usage and reusable
type: string
example: reusable
expires_in:
description: Expiration time in seconds
type: integer
example: 43200
revoked:
description: Setup key revocation status
type: boolean
example: false
auto_groups:
description: Setup key groups to auto-assign to peers registered with this key
type: array
items:
type: string
example: "devs"
usage_limit:
description: A number of times this key can be used. The value of 0 indicates the unlimited usage.
type: integer
example: 0
required:
- name
- type
@@ -315,24 +370,30 @@ components:
id:
description: ID of a token
type: string
example: ch8i54g6lnn4g9hqv7n0
name:
description: Name of the token
type: string
example: My first token
expiration_date:
description: Date the token expires
type: string
format: date-time
example: 2023-05-05T14:38:28.977616Z
created_by:
description: User ID of the user who created the token
type: string
example: google-oauth2|277474792786460067937
created_at:
description: Date the token was created
type: string
format: date-time
example: 2023-05-02T14:48:20.465209Z
last_used:
description: Date the token was last used
type: string
format: date-time
example: 2023-05-04T12:45:25.9723616Z
required:
- id
- name
@@ -345,6 +406,7 @@ components:
plain_token:
description: Plain text representation of the generated token
type: string
example: 2023-05-02T14:48:20.465209Z
personal_access_token:
$ref: '#/components/schemas/PersonalAccessToken'
required:
@@ -356,11 +418,13 @@ components:
name:
description: Name of the token
type: string
example: My first token
expires_in:
description: Expiration in days
type: integer
minimum: 1
maximum: 365
example: 30
required:
- name
- expires_in
@@ -370,12 +434,15 @@ components:
id:
description: Group ID
type: string
example: ch8i4ug6lnn4g9hqv7m0
name:
description: Group Name identifier
type: string
example: devs
peers_count:
description: Count of peers associated to the group
type: integer
example: 2
required:
- id
- name
@@ -386,11 +453,13 @@ components:
name:
type: string
description: Group name identifier
example: devs
peers:
type: array
description: List of peers ids
items:
type: string
example: "ch8i4ug6lnn4g9hqv7m1"
required:
- name
Group:
@@ -411,15 +480,19 @@ components:
name:
description: Rule name identifier
type: string
example: Default
description:
description: Rule friendly description
type: string
example: This is a default rule that allows connections between all the resources
disabled:
description: Rules status
type: boolean
example: false
flow:
description: Rule flow, currently, only "bidirect" for bi-directional traffic is accepted
type: string
example: bidirect
required:
- name
- description
@@ -435,11 +508,13 @@ components:
description: List of source groups
items:
type: string
example: "ch8i4ug6lnn4g9hqv7m1"
destinations:
type: array
description: List of destination groups
items:
type: string
example: "ch8i4ug6lnn4g9hqv7m0"
Rule:
allOf:
- type: object
@@ -447,6 +522,7 @@ components:
id:
description: Rule ID
type: string
example: ch8i4ug6lnn4g9hqv7mg
required:
- id
- $ref: '#/components/schemas/RuleMinimum'
@@ -471,15 +547,19 @@ components:
id:
description: Rule ID
type: string
example: ch8i4ug6lnn4g9hqv7mg
name:
description: Rule name identifier
type: string
example: Default
description:
description: Rule friendly description
type: string
example: This is a default rule that allows connections between all the resources
enabled:
description: Rules status
type: boolean
example: true
sources:
description: policy source groups
type: array
@@ -494,6 +574,7 @@ components:
description: policy accept or drops packets
type: string
enum: ["accept","drop"]
example: accept
required:
- name
- sources
@@ -506,15 +587,19 @@ components:
name:
description: Policy name identifier
type: string
example: ch8i4ug6lnn4g9hqv7mg
description:
description: Policy friendly description
type: string
example: This is a default policy that allows connections between all the resources
enabled:
description: Policy status
type: boolean
example: true
query:
description: Policy Rego query
type: string
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:
description: Policy rule object for policy UI editor
type: array
@@ -534,6 +619,7 @@ components:
id:
description: Policy ID
type: string
example: ch8i4ug6lnn4g9hqv7mg
required:
- id
RouteRequest:
@@ -542,33 +628,41 @@ components:
description:
description: Route description
type: string
example: My first route
network_id:
description: Route network identifier, to group HA routes
type: string
maxLength: 40
minLength: 1
example: Route 1
enabled:
description: Route status
type: boolean
example: true
peer:
description: Peer Identifier associated with route
type: string
example: chacbco6lnnbn6cg5s91
network:
description: Network range in CIDR format
type: string
example: 10.64.0.0/24
metric:
description: Route metric number. Lowest number has higher priority
type: integer
maximum: 9999
minimum: 1
example: 9999
masquerade:
description: Indicate if peer should masquerade traffic to this route's prefix
type: boolean
example: true
groups:
description: Route group tag groups
type: array
items:
type: string
example: "chacdk86lnnboviihd70"
required:
- id
- description
@@ -586,9 +680,11 @@ components:
id:
description: Route Id
type: string
example: chacdk86lnnboviihd7g
network_type:
description: Network type indicating if it is IPv4 or IPv6
type: string
example: IPv4
required:
- id
- network_type
@@ -599,13 +695,16 @@ components:
ip:
description: Nameserver IP
type: string
example: 8.8.8.8
ns_type:
description: Nameserver Type
type: string
enum: [ "udp" ]
example: udp
port:
description: Nameserver Port
type: integer
example: 53
required:
- ip
- ns_type
@@ -618,9 +717,11 @@ components:
type: string
maxLength: 40
minLength: 1
example: Google DNS
description:
description: Nameserver group description
type: string
example: Google DNS servers
nameservers:
description: Nameserver group
minLength: 1
@@ -631,14 +732,17 @@ components:
enabled:
description: Nameserver group status
type: boolean
example: true
groups:
description: Nameserver group tag groups
type: array
items:
type: string
example: ch8i4ug6lnn4g9hqv7m0
primary:
description: Nameserver group primary status
type: boolean
example: true
domains:
description: Nameserver group domain list
type: array
@@ -646,6 +750,7 @@ components:
type: string
minLength: 1
maxLength: 255
example: "example.com"
required:
- name
- description
@@ -661,6 +766,7 @@ components:
id:
description: Nameserver group ID
type: string
example: ch8i4ug6lnn4g9hqv7m0
required:
- id
- $ref: '#/components/schemas/NameserverGroupRequest'
@@ -672,6 +778,7 @@ components:
type: array
items:
type: string
example: ch8i4ug6lnn4g9hqv7m0
required:
- disabled_management_groups
Event:
@@ -680,13 +787,16 @@ components:
id:
description: Event unique identifier
type: string
example: 10
timestamp:
description: The date and time when the event occurred
type: string
format: date-time
example: 2023-05-05T10:04:37.473542Z
activity:
description: The activity that occurred during the event
type: string
example: Route created
activity_code:
description: The string code of the activity that occurred during the event
type: string
@@ -702,17 +812,21 @@ components:
"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" ]
example: route.add
initiator_id:
description: The ID of the initiator of the event. E.g., an ID of a user that triggered the event.
type: string
example: google-oauth2|123456789012345678901
target_id:
description: The ID of the target of the event. E.g., an ID of the peer that a user removed.
type: string
example: chad9d86lnnc59g18ou0
meta:
description: The metadata of the event
type: object
additionalProperties:
type: string
example: { "name": "my route", "network_range": "10.64.0.0/24", "peer_id": "chacbco6lnnbn6cg5s91"}
required:
- id
- timestamp