add 'contain' command for common configs

add flag 'full' for 'get' command
update bash complete
This commit is contained in:
DeniskaRediska committed 2019-10-30 14:58:50 +03:00
1 parent 1a3458ebdd
commit 8b8815d2f2
21 files changed
+348 -54

No files matched your search

+14 -2
View File
@@ -66,6 +66,18 @@ type ConfigSchema struct {
UpdatedAt time.Time
}
type deleted struct {
Deleted int
type Deleted struct {
Deleted bool
Links Links
}
type Links map[string][]string
type identityRequest struct {
Id string
}
type CompileConfigs struct {
Data map[string]interface{}
CommonConfigsIdList []string
}
+2
View File
@@ -8,4 +8,6 @@ const (
getCommonConfigs = "config/common_config/get_configs"
createUpdateCommonConfig = "config/common_config/create_update_config"
deleteCommonConfig = "config/common_config/delete_config"
getLinksCommonConfig = "config/common_config/get_links"
compileCommonConfigs = "config/common_config/compile"
)
+27 -5
View File
@@ -104,13 +104,35 @@ func (c *configClient) CreateUpdateCommonConfig(req CommonConfig) (*CommonConfig
}
}
func (c *configClient) DeleteCommonConfig(req []string) (int, error) {
response := new(deleted)
err := c.cli.Invoke(deleteCommonConfig, callerId, req, response, backend.WithMetadata(c.headers))
func (c *configClient) DeleteCommonConfig(id string) (*Deleted, error) {
request := identityRequest{Id: id}
response := new(Deleted)
err := c.cli.Invoke(deleteCommonConfig, callerId, request, response, backend.WithMetadata(c.headers))
if err != nil {
return 0, c.errorHandler(err)
return nil, c.errorHandler(err)
} else {
return response.Deleted, nil
return response, nil
}
}
func (c *configClient) GetLinksCommonConfig(id string) (*Links, error) {
request := identityRequest{Id: id}
response := new(Links)
err := c.cli.Invoke(getLinksCommonConfig, callerId, request, response, backend.WithMetadata(c.headers))
if err != nil {
return nil, c.errorHandler(err)
} else {
return response, nil
}
}
func (c *configClient) CompileCommonConfigs(request CompileConfigs) (map[string]interface{}, error) {
response := make(map[string]interface{})
err := c.cli.Invoke(compileCommonConfigs, callerId, request, &response, backend.WithMetadata(c.headers))
if err != nil {
return nil, c.errorHandler(err)
} else {
return response, nil
}
}