X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fagent%2Fapiv1.go;h=1921f981b5d5b79c3cb073b55e183ebcae21f8ce;hb=38e0baedab9da4516cdc97b526392cbc2c7da67e;hp=a66f451bb41d30d2bafc6d83aceaaa47380a86d5;hpb=f1083a8259b3d2f560b5f3ccb8b47c94e297d7fa;p=src%2Fxds%2Fxds-agent.git diff --git a/lib/agent/apiv1.go b/lib/agent/apiv1.go index a66f451..1921f98 100644 --- a/lib/agent/apiv1.go +++ b/lib/agent/apiv1.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,9 +21,10 @@ import ( "fmt" "strconv" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent/lib/xaapiv1" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent/lib/xdsconfig" + "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xsapiv1" "github.com/gin-gonic/gin" - "github.com/iotbzh/xds-agent/lib/xdsconfig" - "github.com/iotbzh/xds-server/lib/xsapiv1" ) const apiBaseURL = "/api/v1" @@ -163,3 +164,18 @@ func (s *APIService) DelXdsServer(id string) error { s.xdsServers[id].Close() return nil } +} + +// UpdateXdsServer Update XDS Server configuration settings +func (s *APIService) UpdateXdsServer(cfg xaapiv1.ServerCfg) error { + if _, exist := s.xdsServers[cfg.ID]; !exist { + return fmt.Errorf("Unknown Server ID %s", cfg.ID) + } + + svr := s.xdsServers[cfg.ID] + + // Update only some configurable fields + svr.ConnRetry = cfg.ConnRetry + + return nil +}