Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e09ff7b95 | ||
|
|
63ad9bb620 | ||
|
|
13803ab804 |
No files matched your search
@@ -1,4 +0,0 @@
|
||||
include:
|
||||
- project: '$CI_PROJECT_PATH'
|
||||
file: '/ci-isp-utils.yml'
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
### v3.3.1
|
||||
* увеличены таймауты обращения к `isp-config-service`
|
||||
### v3.3.0
|
||||
* Добавлены команды `vars get`, `vars list`, `vars set`, `vars delete`, `vars upload`
|
||||
* Обновлены зависимости
|
||||
* Обновлена версия Go до `1.24`
|
||||
### v3.2.1
|
||||
* обновлены зависимости
|
||||
### v3.2.0
|
||||
* добавлена поддержка тегов для `gitget`
|
||||
### v3.1.1
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
FROM golang:1.24-alpine3.21 as builder
|
||||
WORKDIR /build
|
||||
ARG version
|
||||
ENV version_env=$version
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download -x
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,target=. \
|
||||
go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
|
||||
FROM alpine:3.21
|
||||
|
||||
RUN apk add --no-cache tzdata bash-completion jq
|
||||
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN echo "Europe/Moscow" > /etc/timezone
|
||||
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY --from=builder main /usr/bin/$app_name_env
|
||||
COPY /conf/config.yml /etc/$app_name_env/config.yml
|
||||
COPY /static/autocomplete /etc/bash_completion.d/$app_name_env
|
||||
|
||||
CMD ["exec $app_name_env"]
|
||||
@@ -1,41 +0,0 @@
|
||||
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
|
||||
RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.24 git
|
||||
WORKDIR /build
|
||||
ARG version
|
||||
ENV version_env=$version
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY . .
|
||||
ENV GOPROXY=https://repo-mirror.mos.ru/repository/go-public
|
||||
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
|
||||
|
||||
FROM dockerhub.mos.ru/mosos/arbat:15.5
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN echo "Europe/Moscow" > /etc/timezone
|
||||
|
||||
ARG UID=10001
|
||||
RUN useradd \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
--user-group \
|
||||
appuser
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
RUN chown appuser:appuser /app/data
|
||||
VOLUME /app/data
|
||||
|
||||
USER appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY --from=builder main /app/$app_name_env
|
||||
COPY /conf/config.yml /etc/$app_name_env/config.yml
|
||||
COPY /static/autocomplete /etc/bash_completion.d/$app_name_env
|
||||
|
||||
CMD ["exec $app_name_env"]
|
||||
@@ -15,12 +15,7 @@
|
||||
- [ispctl schema](#ispctl-schema)
|
||||
- [ispctl merge](#ispctl-merge)
|
||||
- [ispctl gitget](#ispctl-gitget)
|
||||
- [ispctl vars](#ispctl-vars)
|
||||
- [ispctl vars get](#ispctl-vars-get)
|
||||
- [ispctl vars list](#ispctl-vars-list)
|
||||
- [ispctl vars set](#ispctl-vars-set)
|
||||
- [ispctl vars delete](#ispctl-vars-delete)
|
||||
- [ispctl vars upload](#ispctl-vars-upload)
|
||||
|
||||
|
||||
## Требования
|
||||
* Linux
|
||||
@@ -37,17 +32,12 @@ ispctl [flag...] get module_name property_path [local_flag]
|
||||
ispctl [flag...] set module_name property_path [new_object]
|
||||
ispctl [flag...] delete module_name property_path
|
||||
ispctl [flag...] schema module_name [local_flag]
|
||||
ispctl [flag...] vars get variable_name
|
||||
ispctl [flag...] vars list
|
||||
ispctl [flag...] vars set [local_flag] variable_name variable_value
|
||||
ispctl [flag...] vars delete variable_name
|
||||
ispctl [flag...] vars upload csv_filepath
|
||||
```
|
||||
|
||||
## Описание
|
||||
|
||||
| Команды | Описание |
|
||||
| ------------- | --------------------------------------------------------------------------- |
|
||||
|----------|-----------------------------------------------------------------------------|
|
||||
| `status` | возвращает доступные конфигурации модулей, их состояния и подключения |
|
||||
| `get` | возвращает объект конфигурации указанного модуля |
|
||||
| `set` | изменяет объект конфигурации указанного модуля |
|
||||
@@ -55,38 +45,28 @@ ispctl [flag...] vars upload csv_filepath
|
||||
| `merge` | поблочно производит слияние конфигурации модуля с json конфигом через stdin |
|
||||
| `gitget` | скачивает из репозитория указанный файлы с указанного комита |
|
||||
| `schema` | возвращает схему конфигурации указанного модуля |
|
||||
| `vars get` | выводит информацию о переменной в json формате |
|
||||
| `vars list` | выводит список переменных в виде ASCII-таблицы |
|
||||
| `vars set` | изменяет значение переменной |
|
||||
| `vars delete` | удаляет переменную по имени |
|
||||
| `vars upload` | загружает переменные из csv файла |
|
||||
| | |
|
||||
|
||||
| Флаги | Параметры | Описание |
|
||||
| --------- | --------- | ------------------------------------------------------ |
|
||||
|-------------|-----------|--------------------------------------------------------|
|
||||
| `-g` | string | адрес isp-config-service |
|
||||
| `-unsafe` | | отключает проверку схемы перед изменением конфигурации |
|
||||
| | | |
|
||||
|
||||
| Аргументы | Описание |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------ |
|
||||
|-----------------|-------------------------------------------------------------------------------------------------------------|
|
||||
| `module_name` | Название модуля с которым происходит взаимодействие |
|
||||
| `property_path` | Путь к объекту конфигурации, при значении `.` работа происходит со всей конфигурацией модуля |
|
||||
| `new_object` | Новый объект, значение должно быть экранировано с помощью `' '`, при отсутсвии ожидается ввод из stdin |
|
||||
| `variable_name` | Название переменной с которой происходит взаимодействие |
|
||||
| `variable_value` | Значение переменной |
|
||||
| `csv_filepath` | Путь к csv файлу с переменными для загрузки |
|
||||
| | |
|
||||
|
||||
| Локальные флаги | Параметры | Команды | Описание |
|
||||
| --------------- | --------- | -------- |------------------------------------------------------------------------------------------------------------------------------- |
|
||||
|-----------------|-----------|---------|---------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-o` | string | schema | определяет формат вывода схемы в stdout; по умолчанию `json`; возможные значения `json`, `html` |
|
||||
| `-full` | bool | get | осуществляет взаимодействие с объектами конфигурации модуля с учетом объектом общих конфигураций, которые имеют связь с модулем |
|
||||
| `-secret` | bool | vars set | устанавливает тип переменной в SECRET |
|
||||
| | | | |
|
||||
|
||||
## Пример
|
||||
|
||||
### ispctl status
|
||||
`ispctl [flag...] status [local_flag]`
|
||||
|
||||
@@ -389,110 +369,12 @@ ispctl merge example < example.json
|
||||
ispctl gitget git@github.com:integration-system/ispctl.git main.go d4d7c679aad47ae204c2b3a4587b032a723fe315
|
||||
```
|
||||
|
||||
### ispctl vars
|
||||
#### ispctl vars get
|
||||
|
||||
`ispctl [flag...] vars get variable_name`
|
||||
|
||||
Запрос
|
||||
|
||||
```bash
|
||||
ispctl vars get example_variable
|
||||
```
|
||||
|
||||
Ответ
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "example_variable",
|
||||
"description": "example description text",
|
||||
"type": "TEXT",
|
||||
"value": "some variable value",
|
||||
"containsInConfigs": []
|
||||
}
|
||||
```
|
||||
|
||||
#### ispctl vars list
|
||||
|
||||
`ispctl [flag...] vars list`
|
||||
|
||||
Запрос
|
||||
|
||||
```bash
|
||||
ispctl vars list
|
||||
```
|
||||
|
||||
Ответ
|
||||
|
||||
```bash
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | VALUE | CONFIGS |
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
| var-99 | описание | SECRET | | |
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
| var-6 | описание | SECRET | | |
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
| var-2 | описание | TEXT | 1131231-2131231 | |
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
| var-1 | описание | SECRET | | |
|
||||
+--------+-------------+--------+-----------------+---------+
|
||||
```
|
||||
|
||||
#### ispctl vars set
|
||||
|
||||
`ispctl [flag...] vars set variable_name variable_value`
|
||||
|
||||
Запрос на изменение значения переменной и установку типа TEXT
|
||||
|
||||
```bash
|
||||
ispctl vars set example_variable value
|
||||
```
|
||||
|
||||
Запрос на изменение значения переменной и установку типа SECRET
|
||||
|
||||
```bash
|
||||
ispctl vars set -secret example_variable value
|
||||
```
|
||||
|
||||
#### ispctl vars delete
|
||||
|
||||
`ispctl [flag...] vars delete variable_name`
|
||||
|
||||
Запрос
|
||||
|
||||
```bash
|
||||
ispctl vars delete example_variable
|
||||
```
|
||||
|
||||
#### ispctl vars upload
|
||||
|
||||
`ispctl [flag...] vars upload csv_filepath`
|
||||
|
||||
Запрос
|
||||
|
||||
```bash
|
||||
ispctl vars upload example.csv
|
||||
```
|
||||
|
||||
CSV должен иметь поля `name`, `type`, `value`, `description`
|
||||
пример CSV файла:
|
||||
|
||||
```csv
|
||||
name,type,value,description
|
||||
variable-1,SECRET,var 1 value,Описание 1 переменной
|
||||
variable-2,TEXT,plaintext value,Описание 2 переменной
|
||||
```
|
||||
|
||||
### Запрос с флагами
|
||||
|
||||
Запрос
|
||||
|
||||
```bash
|
||||
ispctl -g '127.0.0.1:9002' set example . '{"metrics":{"address":{"ip":"127.0.0.1","newField":"100","port":1},"gc":1,"memory":false}}'
|
||||
```
|
||||
|
||||
Ответ
|
||||
|
||||
```json
|
||||
{
|
||||
"metrics": {
|
||||
@@ -506,4 +388,3 @@ ispctl -g '127.0.0.1:9002' set example . '{"metrics":{"address":{"ip":"127.0.0.1
|
||||
}
|
||||
}
|
||||
```
|
||||
1
|
||||
+2
-2
@@ -16,9 +16,9 @@ for status in $statusResponse; do
|
||||
read -ra ADDR <<<"$status"
|
||||
for module_name in "${ADDR[0]}"; do
|
||||
if [ -n "$*" ]; then
|
||||
ispctl $* schema -o html $module_name > schemas/$module_name.html
|
||||
ispctl $* schema $module_name -o html > schemas/$module_name.html
|
||||
else
|
||||
ispctl schema -o html $module_name > schemas/$module_name.html
|
||||
ispctl schema $module_name -o html > schemas/$module_name.html
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
+54
-77
@@ -2,106 +2,83 @@ package bash
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"ispctl/model"
|
||||
"ispctl/service"
|
||||
|
||||
"github.com/integration-system/bellows"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/txix-open/bellows"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
const (
|
||||
CommonConfigName = "config_name"
|
||||
ModuleName = "module_name"
|
||||
ModuleData = "module_data"
|
||||
|
||||
VariableName = "variable_name"
|
||||
Empty = "empty"
|
||||
CommonConfigName bashArg = "config_name"
|
||||
CommonConfigData bashArg = "config_data"
|
||||
ModuleName bashArg = "module_name"
|
||||
ModuleData bashArg = "module_data"
|
||||
Empty bashArg = "empty"
|
||||
)
|
||||
|
||||
type BashService interface {
|
||||
GetAllVariables() ([]model.Variable, error)
|
||||
GetAvailableConfigs() ([]model.ModuleInfo, error)
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
type bashArg string
|
||||
|
||||
type bashCommand struct {
|
||||
first bashArg
|
||||
second bashArg
|
||||
}
|
||||
|
||||
type BeforeComplete func(ctx *cli.Context) (service.Config, error)
|
||||
|
||||
type Autocomplete struct {
|
||||
beforeComplete BeforeComplete
|
||||
service BashService
|
||||
}
|
||||
|
||||
func NewAutocomplete(beforeComplete BeforeComplete) Autocomplete {
|
||||
return Autocomplete{
|
||||
beforeComplete: beforeComplete,
|
||||
func Get(first bashArg, second bashArg) *bashCommand {
|
||||
return &bashCommand{
|
||||
first: first,
|
||||
second: second,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) Complete(first string, second string) cli.BashCompleteFunc {
|
||||
return func(ctx *cli.Context) {
|
||||
cfgService, err := c.beforeComplete(ctx)
|
||||
func (c bashCommand) Complete(ctx *cli.Context) {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
commonConfigs, err := service.Config.GetMapNameCommonConfig()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
c.service = cfgService
|
||||
c.complete(ctx, first, second)
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) complete(ctx *cli.Context, first string, second string) {
|
||||
switch ctx.NArg() {
|
||||
case 0:
|
||||
c.completeFirstArg(ctx, first)
|
||||
case 1:
|
||||
c.completeSecondArg(ctx, second)
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) completeFirstArg(ctx *cli.Context, first string) {
|
||||
switch first {
|
||||
switch c.first {
|
||||
case ModuleName:
|
||||
c.printAvailableModules()
|
||||
case VariableName:
|
||||
c.printAvailableVariables()
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) completeSecondArg(ctx *cli.Context, second string) {
|
||||
switch second {
|
||||
case ModuleName:
|
||||
c.printAvailableModules()
|
||||
case ModuleData:
|
||||
c.printModuleData(ctx.Args().First())
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) printAvailableVariables() {
|
||||
vars, err := c.service.GetAllVariables()
|
||||
if err != nil {
|
||||
if arrayOfModules, err := service.Config.GetAvailableConfigs(); err != nil {
|
||||
return
|
||||
}
|
||||
for _, v := range vars {
|
||||
fmt.Println(v.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) printAvailableModules() {
|
||||
modules, err := c.service.GetAvailableConfigs()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, module := range modules {
|
||||
} else {
|
||||
for _, module := range arrayOfModules {
|
||||
fmt.Println(module.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (c Autocomplete) printModuleData(moduleName string) {
|
||||
config, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return
|
||||
case CommonConfigName:
|
||||
for _, config := range commonConfigs {
|
||||
fmt.Println(config.Name)
|
||||
}
|
||||
for key := range bellows.Flatten(config.Data) {
|
||||
}
|
||||
case 1:
|
||||
switch c.second {
|
||||
case CommonConfigData:
|
||||
if config, ok := commonConfigs[ctx.Args().First()]; ok {
|
||||
for key, _ := range bellows.Flatten(config.Data) {
|
||||
fmt.Printf(".%v\n", key)
|
||||
}
|
||||
}
|
||||
case ModuleName:
|
||||
if arrayOfModules, err := service.Config.GetAvailableConfigs(); err != nil {
|
||||
return
|
||||
} else {
|
||||
for _, module := range arrayOfModules {
|
||||
fmt.Println(module.Name)
|
||||
}
|
||||
}
|
||||
case ModuleData:
|
||||
if moduleConfiguration, err := service.Config.GetConfigurationByModuleName(ctx.Args().First()); err != nil {
|
||||
return
|
||||
} else {
|
||||
for key, _ := range bellows.Flatten(moduleConfiguration.Data) {
|
||||
fmt.Printf(".%v\n", key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package model
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/txix-open/isp-kit/cluster"
|
||||
"github.com/txix-open/isp-kit/rc/schema"
|
||||
"github.com/integration-system/isp-kit/cluster"
|
||||
"github.com/integration-system/isp-kit/rc/schema"
|
||||
)
|
||||
|
||||
type GetModuleByUuidAndNameRequest struct {
|
||||
type getModuleByUuidAndNameRequest struct {
|
||||
ModuleName string
|
||||
Uuid string
|
||||
}
|
||||
|
||||
type GetSchemaByModuleIdRequest struct {
|
||||
type getSchemaByModuleIdRequest struct {
|
||||
ModuleId string
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type Config struct {
|
||||
ModuleId string
|
||||
Version int32
|
||||
Active bool
|
||||
Data map[string]any
|
||||
Data map[string]interface{}
|
||||
Unsafe bool
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ type CommonConfig struct {
|
||||
Description string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Data map[string]any
|
||||
Data map[string]interface{}
|
||||
}
|
||||
|
||||
type Connection struct {
|
||||
@@ -62,3 +62,19 @@ type ConfigSchema struct {
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cfg
|
||||
|
||||
const (
|
||||
getAvailableConfigs = "config/module/get_modules_info"
|
||||
getConfigByModuleName = "config/config/get_active_config_by_module_name"
|
||||
createUpdateConfig = "config/config/create_update_config"
|
||||
getSchemaByModuleId = "config/schema/get_by_module_id"
|
||||
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"
|
||||
)
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package cfg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/integration-system/isp-kit/grpc/client"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type ConfigClient struct {
|
||||
cli *client.Client
|
||||
address string
|
||||
}
|
||||
|
||||
func NewConfigClient() *ConfigClient {
|
||||
return &ConfigClient{}
|
||||
}
|
||||
|
||||
func (c *ConfigClient) ReceiveConfig(address string) error {
|
||||
cli, err := client.Default()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.cli = cli
|
||||
cli.Upgrade([]string{address})
|
||||
|
||||
c.address = address
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) GetAvailableConfigs() ([]ModuleInfo, error) {
|
||||
response := make([]ModuleInfo, 0)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(getAvailableConfigs).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getAvailableConfigs)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) GetConfigByModuleName(name string) (*Config, error) {
|
||||
request := &getModuleByUuidAndNameRequest{ModuleName: name}
|
||||
response := new(Config)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(getConfigByModuleName).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getConfigByModuleName)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) CreateUpdateConfig(request Config) (*Config, error) {
|
||||
response := new(Config)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(createUpdateConfig).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", createUpdateConfig)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) GetSchemaByModuleId(moduleId string) (*ConfigSchema, error) {
|
||||
request := getSchemaByModuleIdRequest{ModuleId: moduleId}
|
||||
response := new(ConfigSchema)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(getSchemaByModuleId).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getSchemaByModuleId)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) GetCommonConfigs(req []string) ([]CommonConfig, error) {
|
||||
response := make([]CommonConfig, 0)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(getCommonConfigs).
|
||||
JsonRequestBody(req).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getCommonConfigs)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) CreateUpdateCommonConfig(req CommonConfig) (*CommonConfig, error) {
|
||||
response := new(CommonConfig)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(createUpdateCommonConfig).
|
||||
JsonRequestBody(req).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", createUpdateCommonConfig)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) DeleteCommonConfig(id string) (*Deleted, error) {
|
||||
request := identityRequest{Id: id}
|
||||
response := new(Deleted)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(deleteCommonConfig).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", deleteCommonConfig)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) GetLinksCommonConfig(id string) (*Links, error) {
|
||||
request := identityRequest{Id: id}
|
||||
response := new(Links)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(getLinksCommonConfig).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getLinksCommonConfig)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) CompileCommonConfigs(request CompileConfigs) (map[string]interface{}, error) {
|
||||
response := make(map[string]interface{})
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
|
||||
defer cancel()
|
||||
err := c.cli.Invoke(compileCommonConfigs).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(response).
|
||||
Do(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", compileCommonConfigs)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c *ConfigClient) errorHandler(err error) error {
|
||||
return errors.WithMessagef(err, "isp-config-service: %s", c.address)
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/txix-open/isp-kit/rc/schema"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type AutoComplete interface {
|
||||
Complete(first string, second string) cli.BashCompleteFunc
|
||||
}
|
||||
|
||||
type ConfigService interface {
|
||||
CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error)
|
||||
CreateUpdateConfigV2(configuration *model.Config) (map[string]any, error)
|
||||
DeleteVariable(variableName string) error
|
||||
GetAllVariables() ([]model.Variable, error)
|
||||
GetAvailableConfigs() ([]model.ModuleInfo, error)
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
GetSchemaByModuleId(moduleId string) (schema.Schema, error)
|
||||
GetVariableByName(variableName string) (*model.Variable, error)
|
||||
UpsertVariables(vars []model.UpsertVariableRequest) error
|
||||
}
|
||||
|
||||
type UpdateConfigService interface {
|
||||
CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error)
|
||||
}
|
||||
|
||||
func AllCommands(configService ConfigService, autoComplete AutoComplete) []*cli.Command {
|
||||
status := NewStatus(configService)
|
||||
get := NewGet(configService, autoComplete)
|
||||
set := NewSet(configService, autoComplete)
|
||||
delete := NewDelete(configService, autoComplete)
|
||||
schema := NewSchema(configService, autoComplete)
|
||||
merge := NewMerge(configService, autoComplete)
|
||||
gitGet := NewGitGet()
|
||||
variables := NewVariables(configService, autoComplete)
|
||||
return []*cli.Command{
|
||||
status.Command(),
|
||||
get.Command(),
|
||||
set.Command(),
|
||||
delete.Command(),
|
||||
schema.Command(),
|
||||
merge.Command(),
|
||||
gitGet.Command(),
|
||||
variables.Command(),
|
||||
}
|
||||
}
|
||||
|
||||
func CreateUpdateConfig(stringToChange string, configuration *model.Config, service UpdateConfigService) error {
|
||||
answer, err := service.CreateUpdateConfig(stringToChange, configuration)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if answer != nil {
|
||||
return utils.PrintAnswer(answer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/command/common_config"
|
||||
)
|
||||
|
||||
func CommonConfig() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "common",
|
||||
Usage: "access to common configs commands",
|
||||
Action: cc.action,
|
||||
BashComplete: cc.bachComplete,
|
||||
Subcommands: []*cli.Command{
|
||||
common_config.Get(),
|
||||
common_config.Set(),
|
||||
common_config.Delete(),
|
||||
common_config.Remove(),
|
||||
common_config.Link(),
|
||||
common_config.UnLink(),
|
||||
common_config.Contain(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var cc commonConfigCommand
|
||||
|
||||
type commonConfigCommand struct{}
|
||||
|
||||
func (g commonConfigCommand) action(ctx *cli.Context) error {
|
||||
if ctx.Args().First() == "" {
|
||||
fmt.Print("need use command: ")
|
||||
for _, comm := range CommonConfig().Subcommands {
|
||||
fmt.Printf("[%s] ", comm.Name)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g commonConfigCommand) bachComplete(ctx *cli.Context) {
|
||||
for _, command := range CommonConfig().Subcommands {
|
||||
fmt.Println(command.Name)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Contain() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "contain",
|
||||
Usage: "availability common configuration in module",
|
||||
Action: contain.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.Empty).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var contain containCommand
|
||||
|
||||
type containCommand struct{}
|
||||
|
||||
func (g containCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
|
||||
if configName == "" {
|
||||
return errors.New("empty common config name")
|
||||
}
|
||||
|
||||
config, err := service.Config.GetCommonConfigByName(configName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
links, err := service.Config.GetLinksCommonConfig(config.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
fmt.Printf("config [%s] linked with next modules:\n", configName)
|
||||
for _, link := range links {
|
||||
fmt.Printf("[%s] ", link)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tidwall/sjson"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Delete() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "delete",
|
||||
Usage: "set common configurations",
|
||||
Action: deleteComm.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.CommonConfigData).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var deleteComm deleteCommand
|
||||
|
||||
type deleteCommand struct{}
|
||||
|
||||
func (g deleteCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
|
||||
if configName == "" {
|
||||
return errors.New("empty config name")
|
||||
}
|
||||
|
||||
pathObject, err := utils.CheckPath(pathObject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, err := service.Config.GetCommonConfigByName(configName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
return utils.CreateUpdateCommonConfig("", config)
|
||||
} else {
|
||||
jsonObject, err := json.Marshal(config.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if stringToChange, err := sjson.Delete(string(jsonObject), pathObject); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return utils.CreateUpdateCommonConfig(stringToChange, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Get() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "get",
|
||||
Usage: "get common configurations",
|
||||
Action: get.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.CommonConfigData).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var get getCommand
|
||||
|
||||
type getCommand struct{}
|
||||
|
||||
func (g getCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
|
||||
commonConfigs, err := service.Config.GetMapNameCommonConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if configName == "" {
|
||||
fmt.Printf("available next common configs:\n")
|
||||
for name := range commonConfigs {
|
||||
fmt.Printf("[%s] ", name)
|
||||
}
|
||||
fmt.Println()
|
||||
return nil
|
||||
}
|
||||
|
||||
pathObject, err = utils.CheckPath(pathObject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, ok := commonConfigs[configName]
|
||||
if !ok {
|
||||
return errors.Errorf("common config [%s] not found", configName)
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
utils.PrintAnswer(config.Data)
|
||||
} else if jsonObject, err := json.Marshal(config.Data); err != nil {
|
||||
return err
|
||||
} else {
|
||||
utils.CheckObject(jsonObject, pathObject)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Link() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "link",
|
||||
Usage: "link common configurations to module configuration",
|
||||
Action: link.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.ModuleName).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var link linkCommand
|
||||
|
||||
type linkCommand struct{}
|
||||
|
||||
func (g linkCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
moduleName := ctx.Args().Get(1)
|
||||
|
||||
if err := service.Config.LinkCommonConfigToModule(configName, moduleName); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Remove() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "remove",
|
||||
Usage: "remove common configurations",
|
||||
Action: remove.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.Empty).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var remove removeCommand
|
||||
|
||||
type removeCommand struct{}
|
||||
|
||||
func (g removeCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
|
||||
if configName == "" {
|
||||
return errors.New("empty common config name")
|
||||
}
|
||||
|
||||
config, err := service.Config.GetCommonConfigByName(configName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
links, deleted, err := service.Config.DeleteCommonConfig(config.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if deleted {
|
||||
fmt.Printf("config [%s] deleted\n", config.Name)
|
||||
} else {
|
||||
fmt.Printf("config [%s] not deleted, need unlink in next modules:\n%v\n", config.Name, links)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tidwall/sjson"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/cfg"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func Set() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "set",
|
||||
Usage: "set common configurations",
|
||||
Action: set.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.CommonConfigData).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var set setCommand
|
||||
|
||||
type setCommand struct{}
|
||||
|
||||
func (g setCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
changeObject := ctx.Args().Get(2)
|
||||
|
||||
if configName == "" {
|
||||
return errors.New("empty config name")
|
||||
}
|
||||
|
||||
mapConfigByName, err := service.Config.GetMapNameCommonConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, ok := mapConfigByName[configName]
|
||||
if !ok {
|
||||
config = cfg.CommonConfig{
|
||||
Name: configName,
|
||||
}
|
||||
}
|
||||
|
||||
pathObject, err = utils.CheckPath(pathObject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
changeObject, err = utils.CheckChangeObject(changeObject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
return utils.CreateUpdateCommonConfig(changeObject, config)
|
||||
} else {
|
||||
jsonObject, err := json.Marshal(config.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
changeArgument := utils.ParseSetObject(changeObject)
|
||||
if stringToChange, err := sjson.Set(string(jsonObject), pathObject, changeArgument); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return utils.CreateUpdateCommonConfig(stringToChange, config)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package common_config
|
||||
|
||||
import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func UnLink() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "unlink",
|
||||
Usage: "unlink common configurations from module configuration",
|
||||
Action: unlink.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.ModuleName).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
var unlink unlinkCommand
|
||||
|
||||
type unlinkCommand struct{}
|
||||
|
||||
func (g unlinkCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configName := ctx.Args().First()
|
||||
moduleName := ctx.Args().Get(1)
|
||||
|
||||
if err := service.Config.UnlinkCommonConfigFromModule(configName, moduleName); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+25
-34
@@ -3,45 +3,35 @@ package command
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/tidwall/sjson"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
type DeleteService interface {
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error)
|
||||
}
|
||||
|
||||
type Delete struct {
|
||||
service DeleteService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewDelete(service DeleteService, autoComplete AutoComplete) Delete {
|
||||
return Delete{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Delete) Command() *cli.Command {
|
||||
func Delete() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "delete",
|
||||
Usage: "delete configuration by module_name",
|
||||
Action: c.action,
|
||||
BashComplete: c.autoComplete.Complete(bash.ModuleName, bash.ModuleData),
|
||||
Action: deleteComm.action,
|
||||
BashComplete: bash.Get(bash.ModuleName, bash.ModuleData).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Delete) action(ctx *cli.Context) error {
|
||||
var deleteComm deleteCommand
|
||||
|
||||
type deleteCommand struct{}
|
||||
|
||||
func (d deleteCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
moduleName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
|
||||
moduleConfiguration, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
moduleConfiguration, err := service.Config.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -50,18 +40,19 @@ func (c Delete) action(ctx *cli.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if pathObject == "" {
|
||||
return CreateUpdateConfig("", moduleConfiguration, c.service)
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
return utils.CreateUpdateConfig("", moduleConfiguration)
|
||||
} else {
|
||||
jsonObject, err := json.Marshal(moduleConfiguration.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stringToChange, err := sjson.Delete(string(jsonObject), pathObject)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return CreateUpdateConfig(stringToChange, moduleConfiguration, c.service)
|
||||
if stringToChange, err := sjson.Delete(string(jsonObject), pathObject); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return utils.CreateUpdateConfig(stringToChange, moduleConfiguration)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package command
|
||||
|
||||
import "fmt"
|
||||
|
||||
const (
|
||||
HostFlagName = "gateHost"
|
||||
HostFlagUsage = "isp-config-service address"
|
||||
|
||||
UnsafeFlagName = "unsafe"
|
||||
UnsafeFlagUsage = "disable checking schema for set configuration"
|
||||
|
||||
OutPrintFlagName = "o"
|
||||
OutPrintJsonValue = "json"
|
||||
OutPrintHtmlValue = "html"
|
||||
|
||||
SecretFlagName = "secret"
|
||||
secretVariableFlagUsage = "set variable as secret"
|
||||
)
|
||||
|
||||
var (
|
||||
outPrintStatusUsage = fmt.Sprintf("out print for status; %s", OutPrintJsonValue)
|
||||
outPrintSchemaUsage = fmt.Sprintf("out print for schema; %s or %s", OutPrintJsonValue, OutPrintHtmlValue)
|
||||
)
|
||||
+28
-28
@@ -3,48 +3,47 @@ package command
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
type GetService interface {
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
}
|
||||
|
||||
type Get struct {
|
||||
service SetService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewGet(service SetService, autoComplete AutoComplete) Get {
|
||||
return Get{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Get) Command() *cli.Command {
|
||||
func Get() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "get",
|
||||
Usage: "get configuration by module_name",
|
||||
Action: c.action,
|
||||
BashComplete: c.autoComplete.Complete(bash.ModuleName, bash.ModuleData),
|
||||
Action: get.action,
|
||||
BashComplete: bash.Get(bash.ModuleName, bash.ModuleData).Complete,
|
||||
Flags: []cli.Flag{
|
||||
flag.WithCommonConfig,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c Get) action(ctx *cli.Context) error {
|
||||
var get getCommand
|
||||
|
||||
type getCommand struct{}
|
||||
|
||||
func (g getCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
moduleName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
|
||||
config, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
config, err := service.Config.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
data := config.Data
|
||||
if ctx.Bool(flag.WithCommonConfig.Name) {
|
||||
if data, err = service.Config.CompileDataWithCommonConfigs(data, config.CommonConfigs); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
pathObject, err = utils.CheckPath(pathObject)
|
||||
if err != nil {
|
||||
@@ -52,12 +51,13 @@ func (c Get) action(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
return utils.PrintAnswer(data)
|
||||
}
|
||||
|
||||
utils.PrintAnswer(data)
|
||||
} else {
|
||||
jsonObject, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return utils.CheckObject(jsonObject, pathObject)
|
||||
utils.CheckObject(jsonObject, pathObject)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+11
-19
@@ -13,31 +13,21 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type GitGet struct {
|
||||
semverRegexp *regexp.Regexp
|
||||
}
|
||||
var (
|
||||
semverRegexp = regexp.MustCompile("v([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$")
|
||||
)
|
||||
|
||||
func NewGitGet() GitGet {
|
||||
return GitGet{
|
||||
semverRegexp: regexp.MustCompile(`v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$`),
|
||||
}
|
||||
}
|
||||
|
||||
func (c GitGet) Command() *cli.Command {
|
||||
func GitGet() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "gitget",
|
||||
Usage: "gitget [repository] [file] (commit|tag)",
|
||||
Description: "clone and print specified file from specified repository and specified commit hash or tag",
|
||||
Action: c.action,
|
||||
}
|
||||
}
|
||||
|
||||
func (c GitGet) action(ctx *cli.Context) error {
|
||||
Action: func(context *cli.Context) error {
|
||||
storage := memory.NewStorage()
|
||||
repo := ctx.Args().Get(0)
|
||||
repo := context.Args().Get(0)
|
||||
|
||||
file := ctx.Args().Get(1)
|
||||
commit := ctx.Args().Get(2)
|
||||
file := context.Args().Get(1)
|
||||
commit := context.Args().Get(2)
|
||||
|
||||
repository, err := git.Clone(storage, memfs.New(), &git.CloneOptions{
|
||||
URL: repo,
|
||||
@@ -52,7 +42,7 @@ func (c GitGet) action(ctx *cli.Context) error {
|
||||
|
||||
if commit != "" {
|
||||
checkoutOpts := git.CheckoutOptions{}
|
||||
if c.semverRegexp.MatchString(commit) {
|
||||
if semverRegexp.MatchString(commit) {
|
||||
checkoutOpts.Branch = plumbing.NewTagReferenceName(commit)
|
||||
} else {
|
||||
checkoutOpts.Hash = plumbing.NewHash(commit)
|
||||
@@ -74,4 +64,6 @@ func (c GitGet) action(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
+17
-31
@@ -4,43 +4,26 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
type MergeService interface {
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
CreateUpdateConfigV2(configuration *model.Config) (map[string]any, error)
|
||||
}
|
||||
|
||||
type Merge struct {
|
||||
service MergeService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewMerge(service MergeService, autoComplete AutoComplete) Merge {
|
||||
return Merge{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Merge) Command() *cli.Command {
|
||||
func Merge() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "merge",
|
||||
Usage: "merge actual config with config from stdin",
|
||||
BashComplete: c.autoComplete.Complete(bash.CommonConfigName, bash.Empty),
|
||||
Action: c.action,
|
||||
BashComplete: bash.Get(bash.CommonConfigName, bash.Empty).Complete,
|
||||
Action: func(context *cli.Context) error {
|
||||
err := flag.CheckGlobal(context)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func (c Merge) action(ctx *cli.Context) error {
|
||||
moduleName := ctx.Args().First()
|
||||
config, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
moduleName := context.Args().First()
|
||||
config, err := service.Config.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "get module config '%s'", moduleName)
|
||||
}
|
||||
@@ -54,10 +37,13 @@ func (c Merge) action(ctx *cli.Context) error {
|
||||
config.Data[key] = value
|
||||
}
|
||||
|
||||
result, err := c.service.CreateUpdateConfigV2(config)
|
||||
result, err := service.Config.CreateUpdateConfigV2(config)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "update module config '%s'", moduleName)
|
||||
}
|
||||
utils.PrintAnswer(result)
|
||||
|
||||
return utils.PrintAnswer(result)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
+45
-53
@@ -4,81 +4,73 @@ import (
|
||||
"html/template"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
"ispctl/tmpl"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/rc/schema"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type SchemaService interface {
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
GetSchemaByModuleId(moduleId string) (schema.Schema, error)
|
||||
}
|
||||
|
||||
type Schema struct {
|
||||
service SchemaService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewSchema(service SchemaService, autoComplete AutoComplete) Schema {
|
||||
return Schema{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Schema) Command() *cli.Command {
|
||||
func Schema() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "schema",
|
||||
Usage: "get schema configuration by module_name",
|
||||
Action: c.action,
|
||||
Action: schema.action,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{Name: OutPrintFlagName, Usage: outPrintSchemaUsage, Value: OutPrintJsonValue},
|
||||
flag.OutPrintSchema,
|
||||
},
|
||||
BashComplete: c.autoComplete.Complete(bash.ModuleName, bash.Empty),
|
||||
BashComplete: bash.Get(bash.ModuleName, bash.Empty).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Schema) action(ctx *cli.Context) error {
|
||||
moduleName := ctx.Args().First()
|
||||
schemaConfig, err := c.getSchemaConfig(moduleName)
|
||||
if err != nil {
|
||||
var schema schemaCommand
|
||||
|
||||
type schemaCommand struct{}
|
||||
|
||||
func (s schemaCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
moduleName := ctx.Args().First()
|
||||
|
||||
schema := make(map[string]any)
|
||||
if schemaConfig := s.getSchemaConfig(moduleName); schemaConfig != nil {
|
||||
schema := make(map[string]interface{})
|
||||
schema["title"] = moduleName
|
||||
schema["schema"] = schemaConfig
|
||||
switch ctx.String(OutPrintFlagName) {
|
||||
case OutPrintJsonValue:
|
||||
return utils.PrintAnswer(schema)
|
||||
case OutPrintHtmlValue:
|
||||
return c.printHtml(schema)
|
||||
switch ctx.String(flag.OutPrintSchema.Name) {
|
||||
case flag.OutPrintJsonValue:
|
||||
utils.PrintAnswer(schema)
|
||||
case flag.OutPrintHtmlValue:
|
||||
s.printHtml(schema)
|
||||
default:
|
||||
return errors.Errorf("invalid flag value, expected [%s] or [%s]", OutPrintJsonValue, OutPrintHtmlValue)
|
||||
return errors.Errorf("invalid flag value, expected [%s] or [%s]", flag.OutPrintJsonValue, flag.OutPrintHtmlValue)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s schemaCommand) getSchemaConfig(moduleName string) interface{} {
|
||||
if configuration, err := service.Config.GetConfigurationByModuleName(moduleName); err != nil {
|
||||
utils.PrintError(err)
|
||||
return nil
|
||||
} else if schema, err := service.Config.GetSchemaByModuleId(configuration.ModuleId); err != nil {
|
||||
utils.PrintError(err)
|
||||
return nil
|
||||
} else {
|
||||
return schema
|
||||
}
|
||||
}
|
||||
|
||||
func (c Schema) getSchemaConfig(moduleName string) (schema.Schema, error) {
|
||||
configuration, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
func (s schemaCommand) printHtml(schema map[string]interface{}) {
|
||||
if temp, err := template.New("template").Parse(tmpl.HtmlFile); err != nil {
|
||||
utils.PrintError(err)
|
||||
return
|
||||
} else {
|
||||
if err := temp.ExecuteTemplate(os.Stdout, "template", schema); err != nil {
|
||||
utils.PrintError(err)
|
||||
return
|
||||
}
|
||||
schema, err := c.service.GetSchemaByModuleId(configuration.ModuleId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return schema, nil
|
||||
}
|
||||
|
||||
func (c Schema) printHtml(schema map[string]any) error {
|
||||
temp, err := template.New("template").Parse(tmpl.HtmlFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return temp.ExecuteTemplate(os.Stdout, "template", schema)
|
||||
}
|
||||
+23
-31
@@ -3,46 +3,37 @@ package command
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/tidwall/sjson"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
type SetService interface {
|
||||
GetConfigurationByModuleName(moduleName string) (*model.Config, error)
|
||||
CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error)
|
||||
}
|
||||
|
||||
type Set struct {
|
||||
service SetService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewSet(service SetService, autoComplete AutoComplete) Set {
|
||||
return Set{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Set) Command() *cli.Command {
|
||||
func Set() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "set",
|
||||
Usage: "set configuration by module_name",
|
||||
Action: c.action,
|
||||
BashComplete: c.autoComplete.Complete(bash.ModuleName, bash.ModuleData),
|
||||
Action: set.action,
|
||||
BashComplete: bash.Get(bash.ModuleName, bash.ModuleData).Complete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Set) action(ctx *cli.Context) error {
|
||||
var set setCommand
|
||||
|
||||
type setCommand struct{}
|
||||
|
||||
func (s setCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
moduleName := ctx.Args().First()
|
||||
pathObject := ctx.Args().Get(1)
|
||||
changeObject := ctx.Args().Get(2)
|
||||
|
||||
config, err := c.service.GetConfigurationByModuleName(moduleName)
|
||||
config, err := service.Config.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -58,17 +49,18 @@ func (c Set) action(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if pathObject == "" {
|
||||
return CreateUpdateConfig(changeObject, config, c.service)
|
||||
}
|
||||
return utils.CreateUpdateConfig(changeObject, config)
|
||||
} else {
|
||||
jsonObject, err := json.Marshal(config.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
changeArgument := utils.ParseSetObject(changeObject)
|
||||
stringToChange, err := sjson.Set(string(jsonObject), pathObject, changeArgument)
|
||||
if err != nil {
|
||||
if stringToChange, err := sjson.Set(string(jsonObject), pathObject, changeArgument); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return utils.CreateUpdateConfig(stringToChange, config)
|
||||
}
|
||||
}
|
||||
return CreateUpdateConfig(stringToChange, config, c.service)
|
||||
}
|
||||
+19
-24
@@ -5,11 +5,11 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/flag"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -21,37 +21,31 @@ const (
|
||||
tableConnectedStatus = "CONNECTED"
|
||||
)
|
||||
|
||||
type StatusService interface {
|
||||
GetAvailableConfigs() ([]model.ModuleInfo, error)
|
||||
}
|
||||
|
||||
type Status struct {
|
||||
service StatusService
|
||||
}
|
||||
|
||||
func NewStatus(service StatusService) Status {
|
||||
return Status{service: service}
|
||||
}
|
||||
|
||||
func (c Status) Command() *cli.Command {
|
||||
func Status() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "status",
|
||||
Usage: "get available configs",
|
||||
Action: c.action,
|
||||
Action: status.action,
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{Name: OutPrintFlagName, Usage: outPrintStatusUsage},
|
||||
flag.OutPrintStatus,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c Status) action(ctx *cli.Context) error {
|
||||
arrayOfModules, err := c.service.GetAvailableConfigs()
|
||||
if err != nil {
|
||||
var status statusCommand
|
||||
|
||||
type statusCommand struct{}
|
||||
|
||||
func (statusCommand) action(ctx *cli.Context) error {
|
||||
if err := flag.CheckGlobal(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
switch ctx.String(OutPrintFlagName) {
|
||||
case OutPrintJsonValue:
|
||||
return utils.PrintAnswer(arrayOfModules)
|
||||
if arrayOfModules, err := service.Config.GetAvailableConfigs(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
switch ctx.String(flag.OutPrintStatus.Name) {
|
||||
case flag.OutPrintJsonValue:
|
||||
utils.PrintAnswer(arrayOfModules)
|
||||
default:
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetBorders(tablewriter.Border{Left: false, Top: false, Right: false, Bottom: false})
|
||||
@@ -71,5 +65,6 @@ func (c Status) action(ctx *cli.Context) error {
|
||||
}
|
||||
table.Render()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+26
-17
@@ -2,13 +2,13 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/integration-system/isp-kit/json"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
func CheckPath(pathObject string) (string, error) {
|
||||
@@ -22,7 +22,7 @@ func CheckPath(pathObject string) (string, error) {
|
||||
continue
|
||||
}
|
||||
if key == 1 {
|
||||
pathObject = value
|
||||
pathObject = fmt.Sprintf("%s", value)
|
||||
continue
|
||||
}
|
||||
pathObject = fmt.Sprintf("%s.%s", pathObject, value)
|
||||
@@ -32,7 +32,7 @@ func CheckPath(pathObject string) (string, error) {
|
||||
|
||||
func CheckChangeObject(changeObject string) (string, error) {
|
||||
if changeObject == "" {
|
||||
bytes, err := io.ReadAll(os.Stdin)
|
||||
bytes, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -40,18 +40,26 @@ func CheckChangeObject(changeObject string) (string, error) {
|
||||
}
|
||||
if changeObject == "" {
|
||||
return "", errors.New("expected argument")
|
||||
}
|
||||
} else {
|
||||
return changeObject, nil
|
||||
}
|
||||
}
|
||||
|
||||
func PrintAnswer(data any) error {
|
||||
func PrintAnswer(data interface{}) {
|
||||
encoder := json.NewEncoder(os.Stdout)
|
||||
encoder.SetEscapeHTML(false)
|
||||
encoder.SetIndent("", " ")
|
||||
return encoder.Encode(data)
|
||||
if err := encoder.Encode(data); err != nil {
|
||||
PrintError(err)
|
||||
}
|
||||
}
|
||||
|
||||
func ParseSetObject(argument string) any {
|
||||
func PrintError(err error) {
|
||||
fmt.Println("ERROR:", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
func ParseSetObject(argument string) interface{} {
|
||||
tryParse := []byte(argument)
|
||||
if tryParse[0] == '"' && tryParse[len(tryParse)-1] == '"' {
|
||||
tryParse = tryParse[1 : len(tryParse)-1]
|
||||
@@ -62,12 +70,12 @@ func ParseSetObject(argument string) any {
|
||||
return nil
|
||||
}
|
||||
|
||||
mapStringInterface := make(map[string]any)
|
||||
mapStringInterface := make(map[string]interface{})
|
||||
if err := json.Unmarshal(tryParse, &mapStringInterface); err == nil {
|
||||
return mapStringInterface
|
||||
}
|
||||
|
||||
arrayOfObject := make([]any, 0)
|
||||
arrayOfObject := make([]interface{}, 0)
|
||||
if err := json.Unmarshal(tryParse, &arrayOfObject); err == nil {
|
||||
return arrayOfObject
|
||||
}
|
||||
@@ -90,15 +98,16 @@ func ParseSetObject(argument string) any {
|
||||
return argument
|
||||
}
|
||||
|
||||
func CheckObject(jsonObject []byte, depth string) error {
|
||||
func CheckObject(jsonObject []byte, depth string) {
|
||||
jsonString := gjson.GetBytes(jsonObject, depth)
|
||||
if jsonString.Raw == "" {
|
||||
return errors.Errorf("path '%s' not found\n", depth)
|
||||
PrintError(errors.Errorf("path '%s' not found\n", depth))
|
||||
} else {
|
||||
var data interface{}
|
||||
if err := json.Unmarshal([]byte(jsonString.Raw), &data); err != nil {
|
||||
PrintError(err)
|
||||
} else {
|
||||
PrintAnswer(data)
|
||||
}
|
||||
var data any
|
||||
err := json.Unmarshal([]byte(jsonString.Raw), &data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return PrintAnswer(data)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"ispctl/cfg"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func CreateUpdateCommonConfig(stringToChange string, configuration cfg.CommonConfig) error {
|
||||
if answer, err := service.Config.CreateUpdateCommonConfig(stringToChange, configuration); err != nil {
|
||||
return err
|
||||
} else if answer != nil {
|
||||
PrintAnswer(answer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"ispctl/cfg"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
func CreateUpdateConfig(stringToChange string, configuration *cfg.Config) error {
|
||||
if answer, err := service.Config.CreateUpdateConfig(stringToChange, configuration); err != nil {
|
||||
return err
|
||||
} else if answer != nil {
|
||||
PrintAnswer(answer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
-172
@@ -1,172 +0,0 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"ispctl/bash"
|
||||
"ispctl/command/utils"
|
||||
"ispctl/model"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
type VariablesService interface {
|
||||
GetAllVariables() ([]model.Variable, error)
|
||||
GetVariableByName(variableName string) (*model.Variable, error)
|
||||
DeleteVariable(variableName string) error
|
||||
UpsertVariables(vars []model.UpsertVariableRequest) error
|
||||
}
|
||||
|
||||
type Variables struct {
|
||||
service VariablesService
|
||||
autoComplete AutoComplete
|
||||
}
|
||||
|
||||
func NewVariables(service VariablesService, autoComplete AutoComplete) Variables {
|
||||
return Variables{
|
||||
service: service,
|
||||
autoComplete: autoComplete,
|
||||
}
|
||||
}
|
||||
|
||||
func (c Variables) Command() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "vars",
|
||||
Usage: "manage variables",
|
||||
Subcommands: []*cli.Command{
|
||||
{
|
||||
Name: "get",
|
||||
Usage: "vars get <name>",
|
||||
Action: c.getByName,
|
||||
BashComplete: c.autoComplete.Complete(bash.VariableName, bash.Empty),
|
||||
},
|
||||
{
|
||||
Name: "list",
|
||||
Usage: "list all variables",
|
||||
Action: c.list,
|
||||
},
|
||||
{
|
||||
Name: "set",
|
||||
Usage: "vars set <name> <value>",
|
||||
Action: c.set,
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: SecretFlagName, Usage: secretVariableFlagUsage},
|
||||
},
|
||||
BashComplete: c.autoComplete.Complete(bash.VariableName, bash.Empty),
|
||||
},
|
||||
{
|
||||
Name: "delete",
|
||||
Usage: "vars delete <name>",
|
||||
Action: c.delete,
|
||||
BashComplete: c.autoComplete.Complete(bash.VariableName, bash.Empty),
|
||||
},
|
||||
{
|
||||
Name: "upload",
|
||||
Usage: "vars upload <filepath>",
|
||||
Action: c.upload,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (c Variables) list(ctx *cli.Context) error {
|
||||
vars, err := c.service.GetAllVariables()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
table := tablewriter.NewWriter(os.Stdout)
|
||||
table.SetHeader([]string{"Name", "Description", "Type", "Value", "Configs"})
|
||||
for _, v := range vars {
|
||||
configs := make([]string, 0, len(v.ContainsInConfigs))
|
||||
for _, c := range v.ContainsInConfigs {
|
||||
configs = append(configs, c.Name)
|
||||
}
|
||||
table.Append([]string{v.Name, v.Description, v.Type, v.Value, strings.Join(configs, ",")})
|
||||
}
|
||||
table.SetBorder(true)
|
||||
table.SetRowLine(true)
|
||||
table.Render()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c Variables) getByName(ctx *cli.Context) error {
|
||||
variableName := ctx.Args().Get(0)
|
||||
variable, err := c.service.GetVariableByName(variableName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return utils.PrintAnswer(variable)
|
||||
}
|
||||
|
||||
func (c Variables) set(ctx *cli.Context) error {
|
||||
variableName := ctx.Args().Get(0)
|
||||
variableValue := ctx.Args().Get(1)
|
||||
variableType := model.TextVariableType
|
||||
if ctx.Bool(SecretFlagName) {
|
||||
variableType = model.SecretVariableType
|
||||
}
|
||||
return c.service.UpsertVariables([]model.UpsertVariableRequest{{
|
||||
Name: variableName,
|
||||
Value: variableValue,
|
||||
Type: variableType,
|
||||
}})
|
||||
}
|
||||
|
||||
func (c Variables) delete(ctx *cli.Context) error {
|
||||
return c.service.DeleteVariable(ctx.Args().Get(0))
|
||||
}
|
||||
|
||||
func (c Variables) upload(ctx *cli.Context) error {
|
||||
variables, err := c.readVariablesFromCsv(ctx.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.service.UpsertVariables(variables)
|
||||
}
|
||||
|
||||
func (c Variables) readVariablesFromCsv(filepath string) ([]model.UpsertVariableRequest, error) {
|
||||
file, err := os.Open(filepath)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "failed to open file %s", filepath)
|
||||
}
|
||||
defer func() {
|
||||
_ = file.Close()
|
||||
}()
|
||||
|
||||
reader := csv.NewReader(file)
|
||||
reader.TrimLeadingSpace = true
|
||||
records, err := reader.ReadAll()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "failed to read CSV file")
|
||||
}
|
||||
if len(records) < 2 {
|
||||
return nil, errors.New("CSV file must have a header and at least one data row")
|
||||
}
|
||||
|
||||
header := records[0]
|
||||
columnIndexes := map[string]int{}
|
||||
for i, col := range header {
|
||||
columnIndexes[strings.ToLower(col)] = i
|
||||
}
|
||||
|
||||
for _, columnName := range []string{"name", "type", "value", "description"} {
|
||||
_, ok := columnIndexes[columnName]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("column '%s' is required", columnName)
|
||||
}
|
||||
}
|
||||
|
||||
variables := make([]model.UpsertVariableRequest, 0, len(records)-1)
|
||||
for _, row := range records[1:] {
|
||||
variables = append(variables, model.UpsertVariableRequest{
|
||||
Name: row[columnIndexes["name"]],
|
||||
Type: row[columnIndexes["type"]],
|
||||
Value: row[columnIndexes["value"]],
|
||||
Description: row[columnIndexes["description"]],
|
||||
})
|
||||
}
|
||||
return variables, nil
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package flag
|
||||
|
||||
import "fmt"
|
||||
|
||||
const (
|
||||
hostName = "gateHost"
|
||||
hostUsage = "isp-config-service address"
|
||||
|
||||
unsafeName = "unsafe"
|
||||
unsafeUsage = "disable checking schema for set configuration"
|
||||
|
||||
outPrintName = "o"
|
||||
OutPrintJsonValue = "json"
|
||||
OutPrintHtmlValue = "html"
|
||||
|
||||
withCommonConfigName = "full"
|
||||
withCommonConfigUsage = "compile data with common configs"
|
||||
)
|
||||
|
||||
var (
|
||||
outPrintStatusUsage = fmt.Sprintf("out print for status; %s", OutPrintJsonValue)
|
||||
outPrintSchemaUsage = fmt.Sprintf("out print for schema; %s or %s", OutPrintJsonValue, OutPrintHtmlValue)
|
||||
)
|
||||
@@ -0,0 +1,36 @@
|
||||
package flag
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/service"
|
||||
)
|
||||
|
||||
var (
|
||||
//---global---
|
||||
Host = &cli.StringFlag{
|
||||
Name: hostName,
|
||||
Usage: hostUsage,
|
||||
Value: "127.0.0.1:9002",
|
||||
Required: false,
|
||||
Aliases: []string{"g", "configAddr"},
|
||||
}
|
||||
Unsafe = &cli.BoolFlag{Name: unsafeName, Usage: unsafeUsage}
|
||||
//---local---
|
||||
OutPrintStatus = &cli.StringFlag{Name: outPrintName, Usage: outPrintStatusUsage}
|
||||
OutPrintSchema = &cli.StringFlag{Name: outPrintName, Usage: outPrintSchemaUsage, Value: OutPrintJsonValue}
|
||||
WithCommonConfig = &cli.BoolFlag{Name: withCommonConfigName, Usage: withCommonConfigUsage}
|
||||
)
|
||||
|
||||
func CheckGlobal(c *cli.Context) error {
|
||||
var (
|
||||
host string
|
||||
)
|
||||
service.Config.UnsafeEnable = c.Bool(Unsafe.Name)
|
||||
|
||||
host = c.String(Host.Name)
|
||||
host = strings.Replace(host, "'", "", -1)
|
||||
|
||||
return service.Config.ReceiveConfiguration(host)
|
||||
}
|
||||
@@ -1,85 +1,69 @@
|
||||
module ispctl
|
||||
|
||||
go 1.24
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/go-git/go-billy/v5 v5.6.0
|
||||
github.com/go-git/go-git/v5 v5.12.0
|
||||
github.com/go-git/go-billy/v5 v5.5.0
|
||||
github.com/go-git/go-git/v5 v5.10.0
|
||||
github.com/integration-system/bellows v1.0.1
|
||||
github.com/integration-system/isp-kit v1.24.2
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/tidwall/gjson v1.17.3
|
||||
github.com/tidwall/gjson v1.17.0
|
||||
github.com/tidwall/sjson v1.2.5
|
||||
github.com/txix-open/bellows v1.2.0
|
||||
github.com/txix-open/isp-kit v1.44.0
|
||||
github.com/urfave/cli/v2 v2.27.5
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422
|
||||
google.golang.org/grpc v1.69.4
|
||||
github.com/urfave/cli/v2 v2.25.7
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b
|
||||
google.golang.org/grpc v1.59.0
|
||||
)
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.0.0 // indirect
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
|
||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.3.7 // indirect
|
||||
github.com/coder/websocket v1.8.12 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.5 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cloudflare/circl v1.3.5 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3 // indirect
|
||||
github.com/integration-system/jsonschema v1.0.1 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/prometheus/client_golang v1.20.5 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.60.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/prometheus/client_golang v1.17.0 // indirect
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.45.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
|
||||
github.com/skeema/knownhosts v1.2.2 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/skeema/knownhosts v1.2.1 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/txix-open/etp/v4 v4.0.1 // indirect
|
||||
github.com/txix-open/jsonschema v1.2.0 // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/otel v1.33.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.33.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.33.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sync v0.10.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
|
||||
google.golang.org/protobuf v1.36.2 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
golang.org/x/mod v0.13.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
golang.org/x/tools v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
nhooyr.io/websocket v1.8.10 // indirect
|
||||
)
|
||||
@@ -3,32 +3,28 @@ dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
|
||||
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
|
||||
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
|
||||
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
|
||||
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
|
||||
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||
github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU=
|
||||
github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA=
|
||||
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
|
||||
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo=
|
||||
github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
github.com/cloudflare/circl v1.3.5 h1:g+wWynZqVALYAlpSQFAa7TscDnUK8mKYtrxMpw6AUKo=
|
||||
github.com/cloudflare/circl v1.3.5/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -36,48 +32,56 @@ github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcej
|
||||
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||
github.com/getsentry/sentry-go v0.31.1 h1:ELVc0h7gwyhnXHDouXkhqTFSO5oslsRDk0++eyE0KJ4=
|
||||
github.com/getsentry/sentry-go v0.31.1/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
|
||||
github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE=
|
||||
github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
|
||||
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||
github.com/go-git/go-billy/v5 v5.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8=
|
||||
github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM=
|
||||
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
|
||||
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
|
||||
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
|
||||
github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-git/go-git/v5 v5.10.0 h1:F0x3xXrAWmhwtzoCokU4IMPcBdncG+HAAqi9FcOOjbQ=
|
||||
github.com/go-git/go-git/v5 v5.10.0/go.mod h1:1FOZ/pQnqw24ghP2n7cunVl0ON55BsjPYvhWHvZGhoo=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
|
||||
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/integration-system/bellows v1.0.1 h1:7g1lhD/6EcvsSo9iuiFqw98XGS78Sko6kUKPzfte/SY=
|
||||
github.com/integration-system/bellows v1.0.1/go.mod h1:qHPg1ptN3AHHr0f/wvoicfA2LOCprOyrbXnIa5QIRe0=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3 h1:vcHP/PE7p1G3rxqoVKrKtXzoSxFA4ryxigd+zPkAb3w=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3/go.mod h1:ZpB+FIH3hy7md+f8ylVSQx5zwZVjczhkc45f1B2z9nw=
|
||||
github.com/integration-system/isp-kit v1.24.2 h1:ejjSv+CFlPUGV80lxAAleLSa6T/LRoto7evRjSSUF7c=
|
||||
github.com/integration-system/isp-kit v1.24.2/go.mod h1:LvqQyw8PCuuo9O8jgvhKBlOP4UEIYRxb9cHWHuYddcQ=
|
||||
github.com/integration-system/jsonschema v1.0.1 h1:nR78BEDG9djX2uXQ1YP66a/9yQOMmp2HFmw8VPUdAa8=
|
||||
github.com/integration-system/jsonschema v1.0.1/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
@@ -85,126 +89,99 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
|
||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
|
||||
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
|
||||
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
|
||||
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||
github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
|
||||
github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||
github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q=
|
||||
github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY=
|
||||
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
|
||||
github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI=
|
||||
github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM=
|
||||
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
|
||||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
|
||||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A=
|
||||
github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||
github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ=
|
||||
github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94=
|
||||
github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
|
||||
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
||||
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
||||
github.com/txix-open/isp-kit v1.44.0 h1:ao16vgZ/cdbO4sZWYXD4VcJQ+984IQvb/A80mEjU504=
|
||||
github.com/txix-open/isp-kit v1.44.0/go.mod h1:BHRF3AYRcQtEtNvoQZXxTVj/CYOVMKhOcCD3n8CdsxE=
|
||||
github.com/txix-open/jsonschema v1.2.0 h1:B8TrdSsPhDvYv67oi/LVqf7/+PuqFlMsNwUzGeHfl1s=
|
||||
github.com/txix-open/jsonschema v1.2.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99 h1:Z0Sqf+U+Sc6hfIXtRCIZlbJprkCjwMFbS4ZbEPQ44To=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20240401163703-e83541b40f99/go.mod h1:pA0NYmhL0uEkkxj55S+S7MZU4e2QIt46x9XSrzrWc3c=
|
||||
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
|
||||
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
|
||||
github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
|
||||
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw=
|
||||
go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
|
||||
go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ=
|
||||
go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M=
|
||||
go.opentelemetry.io/otel/sdk v1.33.0 h1:iax7M131HuAm9QkZotNHEfstof92xM+N8sr3uHXc2IM=
|
||||
go.opentelemetry.io/otel/sdk v1.33.0/go.mod h1:A1Q5oi7/9XaMlIWzPSxLRWOI8nG3FnzHJNbiENQuihM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
|
||||
go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s=
|
||||
go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck=
|
||||
go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
|
||||
go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
|
||||
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
|
||||
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
|
||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
@@ -212,15 +189,16 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -232,40 +210,46 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
|
||||
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 h1:GVIKPyP/kLIyVOgOnTwFOrvQaQUzOzGMCxgFUOEmm24=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422/go.mod h1:b6h1vNKhxaSoEI+5jc3PJUCustfli/mRab7295pY7rw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 h1:3UsHvIr4Wc2aW4brOaSCmcxh9ksica6fHEr8P1XhkYw=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4=
|
||||
google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A=
|
||||
google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
|
||||
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
|
||||
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
|
||||
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
|
||||
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
@@ -274,7 +258,10 @@ gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYs
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
|
||||
nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q=
|
||||
nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
|
||||
@@ -4,14 +4,10 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"ispctl/bash"
|
||||
"ispctl/command"
|
||||
"ispctl/repository"
|
||||
"ispctl/service"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
"ispctl/command"
|
||||
"ispctl/flag"
|
||||
)
|
||||
|
||||
var version = "1.1.0"
|
||||
@@ -26,33 +22,20 @@ func initCommands() {
|
||||
|
||||
app.Version = version
|
||||
app.Flags = []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: command.HostFlagName,
|
||||
Usage: command.HostFlagUsage,
|
||||
Value: "127.0.0.1:9002",
|
||||
Required: false,
|
||||
Aliases: []string{"g", "configAddr"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: command.UnsafeFlagName,
|
||||
Usage: command.UnsafeFlagUsage,
|
||||
},
|
||||
flag.Host,
|
||||
flag.Unsafe,
|
||||
}
|
||||
app.EnableBashCompletion = true
|
||||
|
||||
var configService service.Config
|
||||
var autoComplete bash.Autocomplete
|
||||
app.Before = func(ctx *cli.Context) error {
|
||||
service, err := configServiceFromGlobalFlags(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
app.Commands = []*cli.Command{
|
||||
command.Status(),
|
||||
command.Get(),
|
||||
command.Set(),
|
||||
command.Delete(),
|
||||
command.Schema(),
|
||||
command.CommonConfig(),
|
||||
command.Merge(),
|
||||
command.GitGet(),
|
||||
}
|
||||
configService = service
|
||||
return nil
|
||||
}
|
||||
autoComplete = bash.NewAutocomplete(configServiceFromGlobalFlags)
|
||||
app.Commands = command.AllCommands(&configService, autoComplete)
|
||||
|
||||
app.BashComplete = func(context *cli.Context) {
|
||||
for _, appCommand := range app.Commands {
|
||||
fmt.Println(appCommand.Name)
|
||||
@@ -64,17 +47,3 @@ func initCommands() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func configServiceFromGlobalFlags(ctx *cli.Context) (service.Config, error) {
|
||||
enableUnsafe := ctx.Bool(command.UnsafeFlagName)
|
||||
|
||||
host := ctx.String(command.HostFlagName)
|
||||
host = strings.ReplaceAll(host, "'", "")
|
||||
|
||||
configCli, err := repository.NewGrpcClientWithHost(host)
|
||||
if err != nil {
|
||||
return service.Config{}, err
|
||||
}
|
||||
configRepo := repository.NewConfig(configCli)
|
||||
return service.NewConfig(enableUnsafe, configRepo), nil
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package model
|
||||
|
||||
import "github.com/pkg/errors"
|
||||
|
||||
var (
|
||||
ErrModuleNotFound = errors.New("module not found")
|
||||
ErrVariableNotFound = errors.New("variable not found")
|
||||
)
|
||||
|
||||
const (
|
||||
SecretVariableType = "SECRET"
|
||||
TextVariableType = "TEXT"
|
||||
|
||||
ErrCodeVariableNotFound = 2006
|
||||
)
|
||||
|
||||
type Variable struct {
|
||||
Name string
|
||||
Description string
|
||||
Type string
|
||||
Value string
|
||||
ContainsInConfigs []LinkedConfig
|
||||
}
|
||||
|
||||
type LinkedConfig struct {
|
||||
Id string
|
||||
ModuleId string
|
||||
Name string
|
||||
}
|
||||
|
||||
type UpsertVariableRequest struct {
|
||||
Name string `validate:"required"`
|
||||
Description string
|
||||
Type string `validate:"required,oneof=SECRET TEXT"`
|
||||
Value string `validate:"required"`
|
||||
}
|
||||
|
||||
type VariableByNameRequest struct {
|
||||
Name string `validate:"required"`
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"github.com/txix-open/isp-kit/grpc/client"
|
||||
)
|
||||
|
||||
func NewGrpcClientWithHost(host string) (*client.Client, error) {
|
||||
cli, err := client.Default()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cli.Upgrade([]string{host})
|
||||
return cli, nil
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"ispctl/model"
|
||||
"strings"
|
||||
|
||||
epb "google.golang.org/genproto/googleapis/rpc/errdetails"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
"github.com/txix-open/isp-kit/grpc/client"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const (
|
||||
getAvailableConfigs = "config/module/get_modules_info"
|
||||
getConfigByModuleName = "config/config/get_active_config_by_module_name"
|
||||
createUpdateConfig = "config/config/create_update_config"
|
||||
getSchemaByModuleId = "config/schema/get_by_module_id"
|
||||
|
||||
getAllVariables = "config/variable/all"
|
||||
getVariableByName = "config/variable/get_by_name"
|
||||
upsertVariable = "config/variable/upsert"
|
||||
deleteVariable = "config/variable/delete"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
cli *client.Client
|
||||
baseCtx context.Context
|
||||
}
|
||||
|
||||
func NewConfig(cli *client.Client) Config {
|
||||
return Config{
|
||||
cli: cli,
|
||||
baseCtx: context.Background(),
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) GetAvailableConfigs() ([]model.ModuleInfo, error) {
|
||||
response := make([]model.ModuleInfo, 0)
|
||||
err := c.cli.Invoke(getAvailableConfigs).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getAvailableConfigs)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c Config) GetConfigByModuleName(name string) (*model.Config, error) {
|
||||
request := &model.GetModuleByUuidAndNameRequest{ModuleName: name}
|
||||
response := new(model.Config)
|
||||
err := c.cli.Invoke(getConfigByModuleName).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
switch {
|
||||
case status.Code(err) == codes.NotFound:
|
||||
return nil, model.ErrModuleNotFound
|
||||
case err != nil:
|
||||
return nil, errors.WithMessagef(err, "call %s", getConfigByModuleName)
|
||||
default:
|
||||
return response, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) CreateUpdateConfig(request model.Config) (*model.Config, error) {
|
||||
response := new(model.Config)
|
||||
err := c.cli.Invoke(createUpdateConfig).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return nil, c.handleCreateUpdateConfigError(err)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c Config) GetSchemaByModuleId(moduleId string) (*model.ConfigSchema, error) {
|
||||
request := model.GetSchemaByModuleIdRequest{ModuleId: moduleId}
|
||||
response := new(model.ConfigSchema)
|
||||
err := c.cli.Invoke(getSchemaByModuleId).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getSchemaByModuleId)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c Config) GetAllVariables() ([]model.Variable, error) {
|
||||
response := make([]model.Variable, 0)
|
||||
err := c.cli.Invoke(getAllVariables).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "call %s", getAllVariables)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c Config) GetVariableByName(variableName string) (*model.Variable, error) {
|
||||
request := model.VariableByNameRequest{Name: variableName}
|
||||
response := new(model.Variable)
|
||||
err := c.cli.Invoke(getVariableByName).
|
||||
JsonRequestBody(request).
|
||||
JsonResponseBody(&response).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return nil, c.handleVariableError(err, getVariableByName)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c Config) UpsertVariables(request []model.UpsertVariableRequest) error {
|
||||
err := c.cli.Invoke(upsertVariable).
|
||||
JsonRequestBody(request).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "call %s", upsertVariable)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c Config) DeleteVariable(variableName string) error {
|
||||
request := model.VariableByNameRequest{Name: variableName}
|
||||
err := c.cli.Invoke(deleteVariable).
|
||||
JsonRequestBody(request).
|
||||
Do(c.baseCtx)
|
||||
if err != nil {
|
||||
return c.handleVariableError(err, deleteVariable)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c Config) handleVariableError(err error, endpoint string) error {
|
||||
apiError := apierrors.FromError(err)
|
||||
if apiError == nil {
|
||||
return errors.WithMessagef(err, "call %s", endpoint)
|
||||
}
|
||||
switch apiError.ErrorCode {
|
||||
case model.ErrCodeVariableNotFound:
|
||||
return model.ErrVariableNotFound
|
||||
default:
|
||||
return errors.WithMessagef(err, "call %s", endpoint)
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) handleCreateUpdateConfigError(err error) error {
|
||||
errorStatus, ok := status.FromError(err)
|
||||
if !ok || errorStatus.Code() != codes.InvalidArgument {
|
||||
return errors.WithMessagef(err, "call %s", createUpdateConfig)
|
||||
}
|
||||
|
||||
stringBuilder := strings.Builder{}
|
||||
stringBuilder.WriteString("doesn't match with schema:\n")
|
||||
|
||||
apiErr := apierrors.FromError(err)
|
||||
if apiErr != nil {
|
||||
for field, desc := range apiErr.Details {
|
||||
stringBuilder.WriteString(fmt.Sprintf("%s | %s\n", field, desc))
|
||||
}
|
||||
} else {
|
||||
for _, detail := range errorStatus.Details() {
|
||||
switch d := detail.(type) {
|
||||
case *epb.BadRequest:
|
||||
for _, violation := range d.FieldViolations {
|
||||
stringBuilder.WriteString(fmt.Sprintf("%s | %s\n", violation.Field, violation.Description))
|
||||
}
|
||||
default:
|
||||
stringBuilder.WriteString(fmt.Sprint(d))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors.New(stringBuilder.String())
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package service
|
||||
|
||||
import "ispctl/cfg"
|
||||
|
||||
var (
|
||||
ConfigClient = cfg.NewConfigClient()
|
||||
)
|
||||
+215
-55
@@ -2,57 +2,62 @@ package service
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"ispctl/model"
|
||||
"ispctl/repository"
|
||||
|
||||
"github.com/integration-system/isp-kit/rc/schema"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/rc/schema"
|
||||
epb "google.golang.org/genproto/googleapis/rpc/errdetails"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"ispctl/cfg"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
enableUnsafe bool
|
||||
configRepo repository.Config
|
||||
var Config configService
|
||||
|
||||
type configService struct {
|
||||
UnsafeEnable bool
|
||||
}
|
||||
|
||||
func NewConfig(enableUnsafe bool, configRepo repository.Config) Config {
|
||||
return Config{
|
||||
enableUnsafe: enableUnsafe,
|
||||
configRepo: configRepo,
|
||||
}
|
||||
func (c configService) ReceiveConfiguration(host string) error {
|
||||
return ConfigClient.ReceiveConfig(host)
|
||||
}
|
||||
|
||||
func (c Config) GetAvailableConfigs() ([]model.ModuleInfo, error) {
|
||||
return c.configRepo.GetAvailableConfigs()
|
||||
func (c configService) GetAvailableConfigs() ([]cfg.ModuleInfo, error) {
|
||||
return ConfigClient.GetAvailableConfigs()
|
||||
}
|
||||
|
||||
func (c Config) GetConfigurationByModuleName(moduleName string) (*model.Config, error) {
|
||||
func (c configService) GetConfigurationByModuleName(moduleName string) (*cfg.Config, error) {
|
||||
if moduleName == "" {
|
||||
return nil, errors.New("need module name")
|
||||
}
|
||||
|
||||
moduleConfiguration, err := c.configRepo.GetConfigByModuleName(moduleName)
|
||||
switch {
|
||||
case errors.Is(err, model.ErrModuleNotFound):
|
||||
if moduleConfiguration, err := ConfigClient.GetConfigByModuleName(moduleName); err != nil {
|
||||
if errorStatus, ok := status.FromError(err); ok {
|
||||
switch errorStatus.Code() {
|
||||
case codes.NotFound:
|
||||
return nil, errors.Errorf("module [%s] not found", moduleName)
|
||||
default:
|
||||
return moduleConfiguration, err
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) GetSchemaByModuleId(moduleId string) (schema.Schema, error) {
|
||||
configSchema, err := c.configRepo.GetSchemaByModuleId(moduleId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return moduleConfiguration, nil
|
||||
}
|
||||
return configSchema.Schema, nil
|
||||
}
|
||||
|
||||
func (c Config) CreateUpdateConfig(stringToChange string, configuration *model.Config) (map[string]any, error) {
|
||||
newData := make(map[string]any)
|
||||
func (c configService) GetSchemaByModuleId(moduleId string) (schema.Schema, error) {
|
||||
if configSchema, err := ConfigClient.GetSchemaByModuleId(moduleId); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
dereferenceSchema := schema.DereferenceSchema(configSchema.Schema)
|
||||
return dereferenceSchema, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c configService) CreateUpdateConfig(stringToChange string, configuration *cfg.Config) (map[string]interface{}, error) {
|
||||
newData := make(map[string]interface{})
|
||||
if stringToChange != "" {
|
||||
err := json.Unmarshal([]byte(stringToChange), &newData)
|
||||
if err != nil {
|
||||
if err := json.Unmarshal([]byte(stringToChange), &newData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -61,49 +66,204 @@ func (c Config) CreateUpdateConfig(stringToChange string, configuration *model.C
|
||||
return c.CreateUpdateConfigV2(configuration)
|
||||
}
|
||||
|
||||
func (c Config) CreateUpdateConfigV2(configuration *model.Config) (map[string]any, error) {
|
||||
configuration.Unsafe = c.enableUnsafe
|
||||
resp, err := c.configRepo.CreateUpdateConfig(*configuration)
|
||||
func (c configService) CreateUpdateConfigV2(configuration *cfg.Config) (map[string]interface{}, error) {
|
||||
configuration.Unsafe = c.UnsafeEnable
|
||||
if resp, err := ConfigClient.CreateUpdateConfig(*configuration); err != nil {
|
||||
if errorStatus, ok := status.FromError(err); ok {
|
||||
switch errorStatus.Code() {
|
||||
case codes.InvalidArgument:
|
||||
fmt.Print("doesn't match with schema:\n")
|
||||
defer func() {
|
||||
os.Exit(1)
|
||||
}()
|
||||
for _, value := range errorStatus.Details() {
|
||||
if a, ok := value.(*epb.BadRequest); ok {
|
||||
for _, value := range a.FieldViolations {
|
||||
fmt.Printf("%s | %s\n", value.Field, value.Description)
|
||||
}
|
||||
} else {
|
||||
fmt.Println(value)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
} else {
|
||||
return resp.Data, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c configService) UpdateConfigAndGetLinkCommon(configuration cfg.Config) ([]string, error) {
|
||||
if resp, err := ConfigClient.CreateUpdateConfig(configuration); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return resp.CommonConfigs, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c configService) GetCommonConfigByName(configName string) (cfg.CommonConfig, error) {
|
||||
if commonConfigs, err := c.GetMapNameCommonConfig(); err != nil {
|
||||
return cfg.CommonConfig{}, err
|
||||
} else if config, ok := commonConfigs[configName]; !ok {
|
||||
return cfg.CommonConfig{}, errors.Errorf("common config [%s] not found", configName)
|
||||
} else {
|
||||
return config, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c configService) GetMapNameCommonConfig() (map[string]cfg.CommonConfig, error) {
|
||||
collection, err := ConfigClient.GetCommonConfigs([]string{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response := make(map[string]cfg.CommonConfig)
|
||||
for _, config := range collection {
|
||||
response[config.Name] = config
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (c configService) CreateUpdateCommonConfig(stringToChange string, config cfg.CommonConfig) (map[string]interface{}, error) {
|
||||
newData := make(map[string]interface{})
|
||||
if stringToChange != "" {
|
||||
if err := json.Unmarshal([]byte(stringToChange), &newData); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
config.Data = newData
|
||||
if resp, err := ConfigClient.CreateUpdateCommonConfig(config); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return resp.Data, nil
|
||||
}
|
||||
|
||||
func (c Config) GetAllVariables() ([]model.Variable, error) {
|
||||
return c.configRepo.GetAllVariables()
|
||||
}
|
||||
|
||||
func (c Config) GetVariableByName(variableName string) (*model.Variable, error) {
|
||||
if variableName == "" {
|
||||
return nil, errors.New("need variable name")
|
||||
func (c configService) DeleteCommonConfig(configId string) ([]string, bool, error) {
|
||||
deletedInfo, err := ConfigClient.DeleteCommonConfig(configId)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
arrayOfModuleName := make([]string, 0)
|
||||
for moduleName := range deletedInfo.Links {
|
||||
arrayOfModuleName = append(arrayOfModuleName, moduleName)
|
||||
}
|
||||
return arrayOfModuleName, deletedInfo.Deleted, nil
|
||||
}
|
||||
|
||||
variable, err := c.configRepo.GetVariableByName(variableName)
|
||||
switch {
|
||||
case errors.Is(err, model.ErrVariableNotFound):
|
||||
return nil, errors.Errorf("variable [%s] not found", variableName)
|
||||
case err != nil:
|
||||
func (c configService) GetLinksCommonConfig(configId string) ([]string, error) {
|
||||
link, err := ConfigClient.GetLinksCommonConfig(configId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
default:
|
||||
return variable, nil
|
||||
}
|
||||
arrayOfModuleName := make([]string, 0)
|
||||
for moduleName := range *link {
|
||||
arrayOfModuleName = append(arrayOfModuleName, moduleName)
|
||||
}
|
||||
return arrayOfModuleName, nil
|
||||
}
|
||||
|
||||
func (c configService) CompileDataWithCommonConfigs(
|
||||
data map[string]interface{}, commonConfigs []string) (map[string]interface{}, error) {
|
||||
|
||||
req := cfg.CompileConfigs{
|
||||
Data: data,
|
||||
CommonConfigsIdList: commonConfigs,
|
||||
}
|
||||
var err error
|
||||
data, err = ConfigClient.CompileCommonConfigs(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return data, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) DeleteVariable(variableName string) error {
|
||||
if variableName == "" {
|
||||
return errors.New("need variable name")
|
||||
func (c configService) UnlinkCommonConfigFromModule(configName, moduleName string) error {
|
||||
return c.linked(configName, moduleName,
|
||||
func(configId string, configIdentities []string) (bool, []string) {
|
||||
needUnlink := false
|
||||
for i, id := range configIdentities {
|
||||
if configId == id {
|
||||
copy(configIdentities[i:], configIdentities[i+1:])
|
||||
configIdentities[len(configIdentities)-1] = ""
|
||||
configIdentities = configIdentities[:len(configIdentities)-1]
|
||||
needUnlink = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return needUnlink, configIdentities
|
||||
})
|
||||
}
|
||||
|
||||
err := c.configRepo.DeleteVariable(variableName)
|
||||
switch {
|
||||
case errors.Is(err, model.ErrVariableNotFound):
|
||||
return errors.Errorf("variable [%s] not found", variableName)
|
||||
default:
|
||||
func (c configService) LinkCommonConfigToModule(configName, moduleName string) error {
|
||||
return c.linked(configName, moduleName,
|
||||
func(configId string, configIdentities []string) (bool, []string) {
|
||||
needLink := true
|
||||
for _, id := range configIdentities {
|
||||
if configId == id {
|
||||
needLink = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if needLink {
|
||||
configIdentities = append(configIdentities, configId)
|
||||
}
|
||||
return needLink, configIdentities
|
||||
})
|
||||
}
|
||||
|
||||
func (c configService) linked(configName, moduleName string,
|
||||
linkHandler func(configId string, configIdentities []string) (bool, []string)) error {
|
||||
|
||||
if configName == "" {
|
||||
return errors.New("empty config name")
|
||||
}
|
||||
|
||||
if moduleName == "" {
|
||||
return errors.New("empty module name")
|
||||
}
|
||||
|
||||
commonConfigs, err := c.GetMapNameCommonConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, ok := commonConfigs[configName]
|
||||
if !ok {
|
||||
return errors.Errorf("common config [%s] not found", configName)
|
||||
}
|
||||
|
||||
func (c Config) UpsertVariables(vars []model.UpsertVariableRequest) error {
|
||||
return c.configRepo.UpsertVariables(vars)
|
||||
moduleConfig, err := c.GetConfigurationByModuleName(moduleName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configIdConfigNameMap := make(map[string]string)
|
||||
for name, value := range commonConfigs {
|
||||
configIdConfigNameMap[value.Id] = name
|
||||
}
|
||||
|
||||
needUpdate, newCommonConfigs := linkHandler(config.Id, moduleConfig.CommonConfigs)
|
||||
|
||||
if needUpdate {
|
||||
moduleConfig.CommonConfigs = newCommonConfigs
|
||||
if linked, err := c.UpdateConfigAndGetLinkCommon(*moduleConfig); err != nil {
|
||||
return err
|
||||
} else {
|
||||
fmt.Printf("module [%s] have next link:\n", moduleName)
|
||||
for _, name := range linked {
|
||||
fmt.Printf("[%s] ", configIdConfigNameMap[name])
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("module [%s] have next link:\n", moduleName)
|
||||
for _, name := range moduleConfig.CommonConfigs {
|
||||
fmt.Printf("[%s] ", configIdConfigNameMap[name])
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+3
-17
@@ -2,30 +2,16 @@
|
||||
|
||||
: ${PROG:=$(basename ${BASH_SOURCE})}
|
||||
|
||||
# Macs have bash3 for which the bash-completion package doesn't include
|
||||
# _init_completion. This is a minimal version of that function.
|
||||
_cli_init_completion() {
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref "$@" cur prev words cword
|
||||
}
|
||||
|
||||
_cli_bash_autocomplete() {
|
||||
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
|
||||
local cur opts base words
|
||||
local cur opts base
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
if declare -F _init_completion >/dev/null 2>&1; then
|
||||
_init_completion -n "=:" || return
|
||||
else
|
||||
_cli_init_completion -n "=:" || return
|
||||
fi
|
||||
words=("${words[@]:0:$cword}")
|
||||
if [[ "$cur" == "-"* ]]; then
|
||||
requestComp="${words[*]} ${cur} --generate-bash-completion"
|
||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
|
||||
else
|
||||
requestComp="${words[*]} --generate-bash-completion"
|
||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
|
||||
fi
|
||||
opts=$(eval "${requestComp}" 2>/dev/null)
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user