Add missing enrollment key swagger parameters (#2767)

* Make swagger param private

* Add missing swagger params for create/update enrollment key

* Use same string in swagger doc path as the parameter

* Re-generate swagger

swagger generate spec -t ee -o swagger.yml
This commit is contained in:
Jonathan Roth 2024-03-12 03:30:44 +02:00 committed by GitHub
parent c082d94c61
commit f370a2923c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 350 additions and 27 deletions

View file

@ -348,8 +348,26 @@ type HostFromNetworkParams struct {
Network string `json:"network"` Network string `json:"network"`
} }
// swagger:parameters createEnrollmentKey
type createEnrollmentKeyParams struct {
// APIEnrollmentKey
// in: body
Body models.APIEnrollmentKey `json:"body"`
}
// swagger:parameters updateEnrollmentKey
type updateEnrollmentKeyParams struct {
// KeyID
// in: path
KeyID string `json:"keyid"`
// APIEnrollmentKey
// in: body
Body models.APIEnrollmentKey `json:"body"`
}
// swagger:parameters deleteEnrollmentKey // swagger:parameters deleteEnrollmentKey
type DeleteEnrollmentKeyParam struct { type deleteEnrollmentKeyParam struct {
// in: path // in: path
KeyID string `json:"keyid"` KeyID string `json:"keyid"`
} }
@ -443,5 +461,8 @@ func useUnused() bool {
_ = signal{} _ = signal{}
_ = filenameToGet{} _ = filenameToGet{}
_ = dnsNetworkPathParam{} _ = dnsNetworkPathParam{}
_ = createEnrollmentKeyParams{}
_ = updateEnrollmentKeyParams{}
_ = deleteEnrollmentKeyParam{}
return false return false
} }

View file

@ -180,7 +180,7 @@ func createEnrollmentKey(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(newEnrollmentKey) json.NewEncoder(w).Encode(newEnrollmentKey)
} }
// swagger:route PUT /api/v1/enrollment-keys/:id enrollmentKeys updateEnrollmentKey // swagger:route PUT /api/v1/enrollment-keys/{keyid} enrollmentKeys updateEnrollmentKey
// //
// Updates an EnrollmentKey for hosts to use on Netmaker server. Updates only the relay to use. // Updates an EnrollmentKey for hosts to use on Netmaker server. Updates only the relay to use.
// //

View file

@ -15,9 +15,43 @@ definitions:
description: ACLContainer - the total list of all node's ACL in a given network description: ACLContainer - the total list of all node's ACL in a given network
type: object type: object
x-go-package: github.com/gravitl/netmaker/logic/acls x-go-package: github.com/gravitl/netmaker/logic/acls
APIEnrollmentKey:
description: APIEnrollmentKey - used to create enrollment keys via API
properties:
expiration:
format: int64
type: integer
x-go-name: Expiration
networks:
items:
type: string
type: array
x-go-name: Networks
relay:
type: string
x-go-name: Relay
tags:
items:
type: string
type: array
x-go-name: Tags
type:
$ref: '#/definitions/KeyType'
unlimited:
type: boolean
x-go-name: Unlimited
uses_remaining:
format: int64
type: integer
x-go-name: UsesRemaining
type: object
x-go-package: github.com/gravitl/netmaker/models
ApiHost: ApiHost:
description: ApiHost - the host struct for API usage description: ApiHost - the host struct for API usage
properties: properties:
autoupdate:
type: boolean
x-go-name: AutoUpdate
debug: debug:
type: boolean type: boolean
x-go-name: Debug x-go-name: Debug
@ -41,12 +75,6 @@ definitions:
isdefault: isdefault:
type: boolean type: boolean
x-go-name: IsDefault x-go-name: IsDefault
isrelay:
type: boolean
x-go-name: IsRelay
isrelayed:
type: boolean
x-go-name: IsRelayed
isstatic: isstatic:
type: boolean type: boolean
x-go-name: IsStatic x-go-name: IsStatic
@ -75,17 +103,13 @@ definitions:
os: os:
type: string type: string
x-go-name: OS x-go-name: OS
persistentkeepalive:
format: int64
type: integer
x-go-name: PersistentKeepalive
publickey: publickey:
type: string type: string
x-go-name: PublicKey x-go-name: PublicKey
relay_hosts:
items:
type: string
type: array
x-go-name: RelayedHosts
relayed_by:
type: string
x-go-name: RelayedBy
verbosity: verbosity:
format: int64 format: int64
type: integer type: integer
@ -135,6 +159,12 @@ definitions:
type: string type: string
type: array type: array
x-go-name: ExtraAllowedIPs x-go-name: ExtraAllowedIPs
postdown:
type: string
x-go-name: PostDown
postup:
type: string
x-go-name: PostUp
publickey: publickey:
type: string type: string
x-go-name: PublicKey x-go-name: PublicKey
@ -187,6 +217,32 @@ definitions:
x-go-name: Ranges x-go-name: Ranges
type: object type: object
x-go-package: github.com/gravitl/netmaker/models x-go-package: github.com/gravitl/netmaker/models
EgressInfo:
description: EgressInfo - struct for egress info
properties:
egress_gateway_cfg:
$ref: '#/definitions/EgressGatewayRequest'
egress_gw_addr:
$ref: '#/definitions/IPNet'
egress_id:
type: string
x-go-name: EgressID
network:
$ref: '#/definitions/IPNet'
type: object
x-go-package: github.com/gravitl/netmaker/models
EgressNetworkRoutes:
description: EgressNetworkRoutes - struct for egress network routes for adding routes to peer's interface
properties:
egress_ranges:
items:
type: string
type: array
x-go-name: EgressRanges
node_addr:
$ref: '#/definitions/IPNet'
type: object
x-go-package: github.com/gravitl/netmaker/models
EnrollmentKey: EnrollmentKey:
description: EnrollmentKey - the key used to register hosts and join them to specific networks description: EnrollmentKey - the key used to register hosts and join them to specific networks
properties: properties:
@ -199,6 +255,10 @@ definitions:
type: string type: string
type: array type: array
x-go-name: Networks x-go-name: Networks
relay:
format: uuid
type: string
x-go-name: Relay
tags: tags:
items: items:
type: string type: string
@ -230,6 +290,11 @@ definitions:
address6: address6:
type: string type: string
x-go-name: Address6 x-go-name: Address6
allowed_ips:
items:
type: string
type: array
x-go-name: AllowedIPs
clientid: clientid:
type: string type: string
x-go-name: ClientID x-go-name: ClientID
@ -265,6 +330,12 @@ definitions:
ownerid: ownerid:
type: string type: string
x-go-name: OwnerID x-go-name: OwnerID
postdown:
type: string
x-go-name: PostDown
postup:
type: string
x-go-name: PostUp
privatekey: privatekey:
type: string type: string
x-go-name: PrivateKey x-go-name: PrivateKey
@ -280,6 +351,19 @@ definitions:
title: File represents an open file descriptor. title: File represents an open file descriptor.
type: object type: object
x-go-package: os x-go-package: os
FwUpdate:
description: FwUpdate - struct for firewall updates
properties:
egress_info:
additionalProperties:
$ref: '#/definitions/EgressInfo'
type: object
x-go-name: EgressInfo
is_egress_gw:
type: boolean
x-go-name: IsEgressGw
type: object
x-go-package: github.com/gravitl/netmaker/models
HardwareAddr: HardwareAddr:
items: items:
format: uint8 format: uint8
@ -362,6 +446,8 @@ definitions:
os: os:
type: string type: string
x-go-name: OS x-go-name: OS
persistentkeepalive:
$ref: '#/definitions/Duration'
publickey: publickey:
$ref: '#/definitions/Key' $ref: '#/definitions/Key'
traffickeypublic: traffickeypublic:
@ -386,11 +472,52 @@ definitions:
x-go-name: WgPublicListenPort x-go-name: WgPublicListenPort
type: object type: object
x-go-package: github.com/gravitl/netmaker/models x-go-package: github.com/gravitl/netmaker/models
HostInfoMap:
additionalProperties:
$ref: '#/definitions/HostNetworkInfo'
description: HostInfoMap - map of host public keys to host networking info
type: object
x-go-package: github.com/gravitl/netmaker/models
HostNetworkInfo:
description: HostNetworkInfo - holds info related to host networking (used for client side peer calculations)
properties:
interfaces:
items:
$ref: '#/definitions/Iface'
type: array
x-go-name: Interfaces
is_static:
type: boolean
x-go-name: IsStatic
listen_port:
format: int64
type: integer
x-go-name: ListenPort
type: object
x-go-package: github.com/gravitl/netmaker/models
HostPull: HostPull:
description: HostPull - response of a host's pull description: HostPull - response of a host's pull
properties: properties:
change_default_gw:
type: boolean
x-go-name: ChangeDefaultGw
default_gw_ip:
type: string
x-go-name: DefaultGwIp
egress_network_routes:
items:
$ref: '#/definitions/EgressNetworkRoutes'
type: array
x-go-name: EgressRoutes
fw_update:
$ref: '#/definitions/FwUpdate'
host: host:
$ref: '#/definitions/Host' $ref: '#/definitions/Host'
host_network_info:
$ref: '#/definitions/HostInfoMap'
is_inet_gw:
type: boolean
x-go-name: IsInternetGw
nodes: nodes:
items: items:
$ref: '#/definitions/Node' $ref: '#/definitions/Node'
@ -413,6 +540,9 @@ definitions:
address: address:
type: string type: string
x-go-name: Address x-go-name: Address
host_id:
type: string
x-go-name: HostID
id: id:
type: string type: string
x-go-name: ID x-go-name: ID
@ -466,6 +596,16 @@ definitions:
x-go-name: Name x-go-name: Name
type: object type: object
x-go-package: github.com/gravitl/netmaker/models x-go-package: github.com/gravitl/netmaker/models
InetNodeReq:
description: InetNodeReq - exit node request struct
properties:
inet_node_client_ids:
items:
type: string
type: array
x-go-name: InetNodeClientIDs
type: object
x-go-package: github.com/gravitl/netmaker/models
Key: Key:
description: |- description: |-
A Key is a public, private, or pre-shared secret key. The Key constructor A Key is a public, private, or pre-shared secret key. The Key constructor
@ -758,13 +898,15 @@ definitions:
format: date-time format: date-time
type: string type: string
x-go-name: ExpirationDateTime x-go-name: ExpirationDateTime
failover: fail_over_peers:
type: boolean additionalProperties:
x-go-name: Failover type: object
failovernode: type: object
x-go-name: FailOverPeers
failed_over_by:
format: uuid format: uuid
type: string type: string
x-go-name: FailoverNode x-go-name: FailedOverBy
hostid: hostid:
format: uuid format: uuid
type: string type: string
@ -773,6 +915,8 @@ definitions:
format: uuid format: uuid
type: string type: string
x-go-name: ID x-go-name: ID
inet_node_req:
$ref: '#/definitions/InetNodeReq'
ingressdns: ingressdns:
type: string type: string
x-go-name: IngressDNS x-go-name: IngressDNS
@ -782,14 +926,21 @@ definitions:
ingressgatewayrange6: ingressgatewayrange6:
type: string type: string
x-go-name: IngressGatewayRange6 x-go-name: IngressGatewayRange6
internetgateway: internetgw_node_id:
$ref: '#/definitions/UDPAddr' type: string
x-go-name: InternetGwID
is_fail_over:
type: boolean
x-go-name: IsFailOver
isegressgateway: isegressgateway:
type: boolean type: boolean
x-go-name: IsEgressGateway x-go-name: IsEgressGateway
isingressgateway: isingressgateway:
type: boolean type: boolean
x-go-name: IsIngressGateway x-go-name: IsIngressGateway
isinternetgateway:
type: boolean
x-go-name: IsInternetGateway
isrelay: isrelay:
type: boolean type: boolean
x-go-name: IsRelay x-go-name: IsRelay
@ -810,6 +961,9 @@ definitions:
x-go-name: LastPeerUpdate x-go-name: LastPeerUpdate
localaddress: localaddress:
$ref: '#/definitions/IPNet' $ref: '#/definitions/IPNet'
metadata:
type: string
x-go-name: Metadata
network: network:
type: string type: string
x-go-name: Network x-go-name: Network
@ -823,8 +977,6 @@ definitions:
pendingdelete: pendingdelete:
type: boolean type: boolean
x-go-name: PendingDelete x-go-name: PendingDelete
persistentkeepalive:
$ref: '#/definitions/Duration'
relayedby: relayedby:
type: string type: string
x-go-name: RelayedBy x-go-name: RelayedBy
@ -930,6 +1082,8 @@ definitions:
type: string type: string
BrokerType: BrokerType:
type: string type: string
CacheEnabled:
type: string
ClientID: ClientID:
type: string type: string
ClientSecret: ClientSecret:
@ -965,6 +1119,8 @@ definitions:
IsEE: IsEE:
type: string type: string
x-go-name: IsPro x-go-name: IsPro
JwtValidityDuration:
$ref: '#/definitions/Duration'
LicenseValue: LicenseValue:
type: string type: string
MQPassword: MQPassword:
@ -997,6 +1153,8 @@ definitions:
type: string type: string
PublicIPService: PublicIPService:
type: string type: string
RacAutoDisable:
type: boolean
RestBackend: RestBackend:
type: string type: string
SQLConn: SQLConn:
@ -1040,9 +1198,18 @@ definitions:
properties: properties:
action: action:
$ref: '#/definitions/SignalAction' $ref: '#/definitions/SignalAction'
from_host_id:
type: string
x-go-name: FromHostID
from_host_pubkey: from_host_pubkey:
type: string type: string
x-go-name: FromHostPubKey x-go-name: FromHostPubKey
from_node_id:
type: string
x-go-name: FromNodeID
is_pro:
type: boolean
x-go-name: IsPro
reply: reply:
type: boolean type: boolean
x-go-name: Reply x-go-name: Reply
@ -1053,12 +1220,15 @@ definitions:
format: int64 format: int64
type: integer type: integer
x-go-name: TimeStamp x-go-name: TimeStamp
to_host_id:
type: string
x-go-name: ToHostID
to_host_pubkey: to_host_pubkey:
type: string type: string
x-go-name: ToHostPubKey x-go-name: ToHostPubKey
turn_relay_addr: to_node_id:
type: string type: string
x-go-name: TurnRelayEndpoint x-go-name: ToNodeID
type: object type: object
x-go-package: github.com/gravitl/netmaker/models x-go-package: github.com/gravitl/netmaker/models
SignalAction: SignalAction:
@ -1114,6 +1284,10 @@ definitions:
issuperadmin: issuperadmin:
type: boolean type: boolean
x-go-name: IsSuperAdmin x-go-name: IsSuperAdmin
last_login_time:
format: date-time
type: string
x-go-name: LastLoginTime
password: password:
type: string type: string
x-go-name: Password x-go-name: Password
@ -1765,6 +1939,41 @@ paths:
summary: Update a network ACL (Access Control List). summary: Update a network ACL (Access Control List).
tags: tags:
- networks - networks
/api/networks/{networkname}/acls/v2:
put:
operationId: updateNetworkACL
parameters:
- description: 'name: network name'
in: path
name: networkname
required: true
type: string
x-go-name: Networkname
- description: ACL Container
in: body
name: acl_container
schema:
$ref: '#/definitions/ACLContainer'
x-go-name: ACLContainer
responses:
"200":
$ref: '#/responses/aclContainerResponse'
schemes:
- https
summary: Update a network ACL (Access Control List).
tags:
- networks
/api/node/{nodeid}/failOverME:
post:
operationId: failOver_me
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: Create a relay.
tags:
- node
/api/nodes: /api/nodes:
get: get:
operationId: getAllNodes operationId: getAllNodes
@ -2014,6 +2223,37 @@ paths:
summary: Remove a relay. summary: Remove a relay.
tags: tags:
- nodes - nodes
/api/nodes/{network}/{nodeid}/inet_gw:
delete:
operationId: deleteInternetGw
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: Delete an internet gw.
tags:
- nodes
post:
operationId: createInternetGw
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: Create an inet node.
tags:
- nodes
put:
operationId: updateInternetGw
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: update an inet node.
tags:
- nodes
/api/nodes/{network}/{nodeid}/ingress/users: /api/nodes/{network}/{nodeid}/ingress/users:
get: get:
operationId: ingressGatewayUsers operationId: ingressGatewayUsers
@ -2300,6 +2540,13 @@ paths:
- enrollmentKeys - enrollmentKeys
post: post:
operationId: createEnrollmentKey operationId: createEnrollmentKey
parameters:
- description: APIEnrollmentKey
in: body
name: body
schema:
$ref: '#/definitions/APIEnrollmentKey'
x-go-name: Body
responses: responses:
"200": "200":
$ref: '#/responses/EnrollmentKey' $ref: '#/responses/EnrollmentKey'
@ -2325,6 +2572,29 @@ paths:
summary: Deletes an EnrollmentKey from Netmaker server. summary: Deletes an EnrollmentKey from Netmaker server.
tags: tags:
- enrollmentKeys - enrollmentKeys
put:
operationId: updateEnrollmentKey
parameters:
- description: KeyID
in: path
name: keyid
required: true
type: string
x-go-name: KeyID
- description: APIEnrollmentKey
in: body
name: body
schema:
$ref: '#/definitions/APIEnrollmentKey'
x-go-name: Body
responses:
"200":
$ref: '#/responses/EnrollmentKey'
schemes:
- https
summary: Updates an EnrollmentKey for hosts to use on Netmaker server. Updates only the relay to use.
tags:
- enrollmentKeys
/api/v1/enrollment-keys/{token}: /api/v1/enrollment-keys/{token}:
post: post:
operationId: handleHostRegister operationId: handleHostRegister
@ -2347,6 +2617,17 @@ paths:
summary: Handles a Netclient registration with server and add nodes accordingly. summary: Handles a Netclient registration with server and add nodes accordingly.
tags: tags:
- enrollmentKeys - enrollmentKeys
/api/v1/fallback/host/{hostid}:
put:
operationId: hostUpdateFallback
responses:
"200":
$ref: '#/responses/apiHostResponse'
schemes:
- https
summary: Updates a Netclient host on Netmaker server.
tags:
- hosts
/api/v1/host: /api/v1/host:
get: get:
description: Used by clients for "pull" command description: Used by clients for "pull" command
@ -2369,6 +2650,27 @@ paths:
summary: Delete all legacy nodes from DB. summary: Delete all legacy nodes from DB.
tags: tags:
- nodes - nodes
/api/v1/node/failover:
delete:
operationId: deletefailOver
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: Create a relay.
tags:
- node
post:
operationId: createfailOver
responses:
"200":
$ref: '#/responses/nodeResponse'
schemes:
- https
summary: Create a relay.
tags:
- node
/api/v1/nodes/migrate: /api/v1/nodes/migrate:
put: put:
operationId: migrateData operationId: migrateData