mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 07:41:17 +00:00
Lookup config/config-type ids when names are provided
This commit is contained in:
@@ -72,9 +72,14 @@ func runCreateConfig(o *createConfigOptions) error {
|
||||
return errors.Errorf("unable to parse data as json: %v", err)
|
||||
}
|
||||
|
||||
configTypeId, err := mapNameToID("config-types", o.Args[1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entityData := gabs.New()
|
||||
setJSONValue(entityData, o.Args[0], "name")
|
||||
setJSONValue(entityData, o.Args[1], "type")
|
||||
setJSONValue(entityData, configTypeId, "type")
|
||||
setJSONValue(entityData, dataMap, "data")
|
||||
result, err := createEntityOfType("configs", entityData.String(), &o.commonOptions)
|
||||
|
||||
|
||||
@@ -74,13 +74,19 @@ func newCreateServiceCmd(f cmdutil.Factory, out io.Writer, errOut io.Writer) *co
|
||||
|
||||
// runCreateService implements the command to create a service
|
||||
func runCreateService(o *createServiceOptions) (err error) {
|
||||
|
||||
configs, err := mapNamesToIDs("configs", o.configs...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entityData := gabs.New()
|
||||
setJSONValue(entityData, o.Args[0], "name")
|
||||
if o.terminatorStrategy != "" {
|
||||
setJSONValue(entityData, o.terminatorStrategy, "terminatorStrategy")
|
||||
}
|
||||
setJSONValue(entityData, o.roleAttributes, "roleAttributes")
|
||||
setJSONValue(entityData, o.configs, "configs")
|
||||
setJSONValue(entityData, configs, "configs")
|
||||
setJSONValue(entityData, o.tags, "tags")
|
||||
|
||||
result, err := createEntityOfType("services", entityData.String(), &o.commonOptions)
|
||||
|
||||
Reference in New Issue
Block a user