MCPcopy Index your code
hub / github.com/deepflowio/deepflow / updateSubDomain

Function updateSubDomain

cli/ctl/sub_domain.go:212–236  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, fileName string)

Source from the content-addressed store, hash-verified

210}
211
212func updateSubDomain(cmd *cobra.Command, args []string, fileName string) error {
213 body, err := formatBody(fileName)
214 if err != nil {
215 return err
216 }
217 if err = validateSubDomainConfig(body, SubDomainTypeUpdate); err != nil {
218 return err
219 }
220
221 if len(args) == 0 {
222 return errors.New("cluster_id is required")
223 }
224 clusterID := args[0]
225 lcuuid, err := getLcuuidByClusterID(cmd, clusterID)
226 if err != nil {
227 return err
228 }
229 server := common.GetServerInfo(cmd)
230 url := fmt.Sprintf("http://%s:%d/v2/sub-domains/%s/", server.IP, server.Port, lcuuid)
231 _, err = common.CURLPerform("PATCH", url, body, "", []common.HTTPOption{common.WithTimeout(common.GetTimeout(cmd)), common.WithORGID(common.GetORGID(cmd))}...)
232 if err != nil {
233 return err
234 }
235 return nil
236}
237
238func validateSubDomainConfig(body map[string]interface{}, subdomainType SubDomainType) error {
239 if subdomainType == SubDomainTypeCreate {

Callers 1

RegisterSubDomainCommandFunction · 0.70

Calls 5

formatBodyFunction · 0.85
validateSubDomainConfigFunction · 0.85
getLcuuidByClusterIDFunction · 0.85
NewMethod · 0.80
GetORGIDMethod · 0.45

Tested by

no test coverage detected