diff --git a/pkg/bootstrap/init.go b/pkg/bootstrap/init.go index 48592803fcc0f8e6876badb219bf10bc22db70ba..0a6320e51ae01b9fe5de2353044bdb7cda8af4b7 100644 --- a/pkg/bootstrap/init.go +++ b/pkg/bootstrap/init.go @@ -268,6 +268,13 @@ type GatewayParams struct { CC string } +type BridgesParams struct { + Location string + Port string + Transport string + Type string +} + // GetGateways returns a list of gateways (it it's enabled by the menshen // API). It optionally accepts a GatewayParams object where you can set // different filters. @@ -287,7 +294,27 @@ func (api *API) GetGateways(p *GatewayParams) ([]*models.ModelsGateway, error) { if err != nil { return nil, err } - return gateways.Payload, err + return gateways.Payload, nil +} + +func (api *API) GetBridges(p *BridgesParams) ([]*models.ModelsBridge, error) { + params := provisioning.NewGet5BridgesParams() + if p != nil { + params.Loc = &p.Location + params.Port = &p.Port + params.Tr = &p.Transport + params.Type = &p.Type + } + if api.httpClient != nil { + params = params.WithHTTPClient(api.httpClient) + } + + bridges, err := api.client.Provisioning.Get5Bridges(params) + if err != nil { + return nil, err + } + + return bridges.Payload, nil } // GetOpenVPNCert returns valid OpenVPN client credentials (certificate and